Table of contents
Development platform: Go1 edu advanced version, with 16-line lidar.
Development machine: Ubuntu20.04
1. Environment dependent installation
Required environment:
Unitree
Legged_sport >= v1.36.0
firmware H0.1.7 >= v0.1.35
H0.1.9 >= v0.1.35
Boost (version 1.5.4 or higher)
CMake (version 2.8.3 or higher)
g++ (version 8.3.0 or higher)
1.1 Boost installation
sudo apt-get update
sudo apt-get install libboost-all-dev
1.2 pybind11 installation
pip3 install pybind11
pip3 install python3-dev pytest
1.3 CMake installation
sudo apt install cmake
1.4 gcc/g++ installation
sudo apt remove g++
sudo apt remove gcc
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install gcc-9 g++-9
1.5 build python wrapper
cmake -DPYTHON_BUILD=TRUE ..
python_wrapper/CMakeLists.txt
Modify line 14 in :
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/third-party/pybind11/include)
If the library file "msgpack.hpp" cannot be found in the global search, you need to install it yourself:
sudo apt install libmsgpack*
If the operation of the control code is not on the working computer but on the robot’s own computer, it is necessary to modify the imported path
.
sys.path.append('../lib/python/amd64')
for
sys.path.append('../lib/python/arm64')
2. Compile the CPP code into a callable dynamic library
1.cd to the directory containing CmakeLists.txt
cd /path/to/directory
2. Create a new folder in the above directory (usually called build, but it can also be named otherwise), and cd to enter
mkdir build && cd build
3. compile
cmake ..
make
4. Install
make install
Use python to import dynamic libraries:
import robot_interface
If there are no errors, you can continue to develop.