Welcome to reCamera Gimbal Programmable Development Kit. We provide sample code to debug the gimbal motor's operation and status output. We offer program entry points to drive the gimbal motor using RS485 or CAN, enabling precise control and functionality.
You can download the STL file of this gimbal for 3D printing and assemble it. (Url: https://makerworld.com/zh/models/536713)
ID changes can be made using MS_Motor/LK motor tool V2.35.exe. Connect the PC (Windows) to the USB-RS485 module, with A, B, and GND of the USB-RS485 module connected to A, B, and V- of the motor. Connect the positive and negative terminals of a 12V power supply to V+ and V- of the motor to enable parameter changes. For further instructions on using LK motor tool V2.35.exe, refer to MS_Motor/Upper_monitor_motor_debuging_instruction.pdf.
Only two motors are used in this head, so it is sufficient to set the IDs of the two motors to 01 and 02 respectively.
If you want a RS485 Bus Analyzer to debug your RS485 Bus, this USB-RS485 Analyzer is recommended.
To enable the reCamera to drive the gimbal motor, the reCamera's base board needs to be replaced to B4_Gyro to enable CAN communication.
You can use the Debugging Port connections to control the motor and communicate with the reCamera via the upper monitor. Alternatively, you can control the motor directly through the reCamera.
It is recommended to use Ubuntu 20.04 to configure this gimbal, as it will be needed for the cross-compilation part. If you don't have Ubuntu 20.04, you can configure TinyCC on reCamera.
Open a terminal in any directory on your Ubuntu system.
sudo apt install vim
git clone https://github.com/sophgo/host-tools.git
After the download is complete go to the file "/host-tools/gcc/riscv64-linux-musl-x86_64/bin"
Enter "pwd" to see the absolute path and copy it.
pwd
cd
vim .bashrc
Based on the previous “pwd” command, add the following to the end of the file
export PATH=$PATH:/home/kong/Downloads/host-tools/gcc/riscv64-linux-musl-x86_64/bin
Click esc and type “:wq” to save the .bashrc.
source .bashrc
Go back to the Seeed_reCamera_Gimbal directory. Compile Deploy_Linux_CAN_Final.c and run it.
riscv64-unknown-linux-musl-gcc -o Deploy Deploy_Linux_CAN_Final.c
Open a terminal in the directory where Deploy is stored.
scp ./Deploy root@192.168.42.1:~/
ssh root@192.168.42.1
./Deploy <degree1> <degree2>
Example: ./Deploy 0 0
Open a terminal in the directory where Deploy_Linux.c is stored.
cd ./reCamera_Deploy
scp ./Deploy_Linux_CAN_Final.c root@192.168.42.1:~/
ssh root@192.168.42.1
The serial port name can be obtained by terminal. It is usually ttyS0.
ls /dev/ttyS*
Open Deploy_Linux_CAN_Final.c and change the serial port name on line 160.
vi ./Deploy_Linux_CAN_Final.c
Compile Deploy_Linux_CAN_Final and run it.
cd ~/
tcc -o test Deploy_Linux.c
./test
Open a terminal in the root directory while making sure Python is installed.
python Deploy_Python.py
Then just enter the angle (0-360 degrees) for both motors.
Make sure your system (Win or Linux) has g++ installed, open a terminal in the root directory.
Win
Open Deploy_Win.cpp and change the serial port name on line 125. The serial port name can be obtained by opening the Device Manager.
g++ Deploy_Win.cpp -o Deploy_Win.exe
Linux
Open Deploy_Linux.cpp and change the serial port name on line 160. The serial port name can be obtained by terminal.
ls /dev/ttyUSB*
g++ Deploy_Linux.cpp -o Deploy_Linux
./Deploy_Linux