This library is used for the communication between PC and the motor control board, so that the user can control the motors by PC. This library includes Linux and Windows version, where the Linux version also support ROS. And we offer the usage examples of C, C++ and Python.
Including the library files of Linux and Windows separately. If you wish to use the SDK under ARM32/64, please modify the CMakeList manually to select the correst .so
file.
Including the header files. Where LSerial.h
contains the declarations of serial port operation functions. The motor_msg.h
contains the command structure for motor communication. The motor_ctrl.h
contains the encoding and decoding functions.
Including the example source files of C and C++. The example can control motors to run under desired command for desired time, and then stop. Please watch out that only the check.c is the full control example with all functions. check.cpp and also the Python example do not contain some comments and important tutorials.
Contains bash scripts which handle patching and distribution.
Including the example source files of Python. This example's function is same with the C/C++ example. The typedef.py
declares the data structure of all library functions and structures in Python style, so that the check.py
can call the library correctly.
mkdir -p build
cd build
cmake ..
make
- Have appropriate permissions
- Ubuntu:
sudo usermod -aG dialout $USER
- Arch:
sudo usermod -aG uucp
cd ..
dist/check_c
dist/check_cpp
scripts/distribute.sh
dist/pyscripts --help
Avoid running the scripts as root.
Under a virtual environment with the keyboard
package, follow the instructions of scripts/patch_keyboard_module.sh
.
Do not forget to log out and log back in after group changes.
Under the catkin workspace, run:
catkin_make
As we cannot use sudo rosrun
, please run as follows:
First, at a terminal, run:
roscore
In another terminal, run:
sudo su
source devel/setup.bash
rosrun unitree_motor_ctrl unitree_motor_ctrl_node
First, at a terminal, run:
roscore
In another terminal, run:
sudo su
source devel/setup.bash
rosrun unitree_motor_ctrl check.py
We take MinGW as an example. First, select the "MinGW Makefiles" in CMake GUI and generate the makefiles to build
directory. Then open the cmd.exe, run:
cd build
mingw32-make.exe
Put the generated .exe file(/bin) and the .dll file(/lib) to same directory, and double click the .exe file to run.
Open the cmd.exe, then:
cd script
check.py