Home

Awesome

ENGINEAI HUMANOID


Locomotion control algorithm for bipedal robots of Shenzhen EngineAI Robotics Technology Co., Ltd. based on the MIT locomotion control algorithm Cheetah Software, mainly includes modules as below:

The simulation environment for sim2sim is currently offered with our RL training repository engineai_legged_gym, and will be transferred to this repository laterly.

Additionally, framework of this repository is designed to combine model based algorithm and learning based algorithm. And the model based part will be opened in the future.

Contents

1. Deploy Process

The control algorithm is mainly used for reinforcement learning (RL) deployment on real robot. This repository works with our RL algorithm engineai_legged_gym.

In order to deploy the trained policy to the robot, there are two devices needed. One which is called local developing device( such as a local PC) is used for compiling this repository to generate the library and executable targets, and the other one is the so called mainboard NaZha which is already equipped in our robot.

1.1 Dependencies Installation

The mainboard (NeZha) is already configured properly, it is not needed to do the following configuraions. We suggest you do not change the default development configuration, in case of failling to run your policy trained with our RL framework engineai_legged_gym

If you are interested in the configuration process, and want to do it by yourself, the following dependencies with specified version are suggested.

Again, WE SUGGEST YOU DO NOT CHANGE THE DEFAULT DEVELOPMENT ENVIRONMENT ON BOARD.

For your local developping device, the following dependencies with the specified version are suggested. If you has any problem with the compiling or running process, remember to check the versions of each depencency.

1.1.1 Cmake

Since onnx is used to update the RL algorithm, cmake version must above 3.26

Download zip and extrac it

$ wget https://cmake.org/files/v3.28/cmake-3.28.5.zip

Move the file to your destination and install cmake

$ cd cmake-3.28.5
$ chmod 777 ./configure
$ ./configure
$ make
$ sudo make install

If you already installed a lower version cmake, replace it with following command

$ sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force

Check your cmake version

$ cmake --version

1.1.2 Eigen

Install eigen with apt install

$ sudo apt install libeigen3-dev

Check whether a folder named "eigen" exist in /usr/local/include/, if not install eigen with make install as following.

$ git clone https://gitlab.com/libeigen/eigen.git
$ cd eigen
$ git checkout 3.3.7
$ mkdir build
$ cd build
$ cmake ..
$ sudo make install

1.1.3 Yaml

Install yaml based on make install

$ git clone https://github.com/jbeder/yaml-cpp.git
$ cd yaml-cpp
$ git checkout yaml-cpp-0.6.3
$ mkdir build
$ cd build
$ cmake -DYAML_BUILD_SHARED_LIBS=ON ..
$ make -j4
$ sudo make install

1.1.4 Lcm

Install the software according to the steps on the LCM official website. lcm 1.4.0 and 1.5.0 are tested, other versions are not guaranteed.

$ git clone https://github.com/lcm-proj/lcm.git
$ cd lcm
$ git checkeout v1.5.0
$ mkdir build
$ cd build
$ cmake -DLCM_ENABLE_JAVA=ON ..
$ make
$ sudo make install

you may need some commands as following

$ sudo apt install build-essential libglib2.0-dev
$ sudo apt install default-jdk python-all-dev liblua5.1-dev golang doxygen
$ sudo apt install openjdk-11-jdk

1.1.5 Ros

Ros is used for onnx and imu library. Follow Ros offical website to install ros-neotic on your computer.

You may used some commands as below

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt install curl
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
$ sudo apt update
$ sudo apt install ros-noetic-desktop-full
$ source /opt/ros/noetic/setup.bash
$ roscore

1.1.6 Other dependency for onnx

$ sudo apt-get update
$ sudo apt-get install -y libprotobuf-dev protobuf-compiler

1.1.7 onnx

Clone onnxruntime from microsoft github

$ git clone https://github.com/microsoft/onnxruntime
$ cd onnxruntime
$ git checkout v1.19.0
$ ./build.sh --config Release --build_shared_lib --parallel --allow_running_as_root
$ cd onnxruntime/build/Linux/Release/
$ sudo make install

onnxruntime version 1.19.0 is suggested. If you would like to use the other version, any conflict generated during the complilation process should be solved by yourself.

1.1.8 libmotor

In the directory of projectpath/dep-pkgs/.., you can get the motor API of our robot, and install it on your local developing device with the following command.

sudo dpkg -i motor-mcu_1.0.8_amd64.deb

To get deep knowledge of how to use the motor libs, please refer to the README.md in that directroy and the source code of this repository.

1.2 Compilation

$ git clone https://github.com/engineai-robotics/engineai_humanoid
$ cd engineai_humanoid/EngineAI_Controller/
$ mkdir build
$ cd build
$ cmake ..
$ make -j
$ make install

And now, you can find a folder named EngineAI_Humanoid within the build directory. And the folder contains all the needed install targets.

1.3 Real Robot Deployment

1.3.1 Control the robot with the default deployment

1.3.1.1 Start robot

The robot is defaulty configured auto-start of the control process. Try to start the robot according to the following steps:

After the above operation, you can now use the joystick to control the robot.

1.3.1.2 Joystick control

Please power on the leg motors with our ESTOP device before you operate the joystick. And press the ESTOP device for once, if you hear the sound "Di Di" for twice, then the motors are powered on. If the sound is heard once, the motors are powered off.

If the robot drifts fast or has an wired orientation when walking without joystick command in RL locomotion mode, you can follow the direction below to calibrate the bias.

Normally, the operation sequency is: power on->LB + back->LB + start->LB + B or LB + A-> make robot stand by itself ->LB + X->LB + A -> lift robot up -> LB + start ->LB + back-> shut down

Note that: When robot stands or walks by itsefly, only use LB + RB, LB + start or LB + backin emergency, robot may fall down after that.

1.3.2 Control the robot with your configuration and policy

$ sudo ifconfig enp0s25 multicast`
$ sudo route add -net 224.0.0.0 netmask 240.0.0.0 dev enp0s25

2. Open-source Requirements

2.1 Code Format

Coding format is defined by the file '.clang-format', how to use:

$ sudo apt install clang-format # install clang-format
$ clang-format -i file_to_format.cpp # specify which file to format
$ find . -regex '.*\.\(cpp\|hpp\|c\|h\)' -exec clang-format -style=file -i {} \; # format all the files ending with .cpp, .hpp, .c and .h under the current directory and its sub-directories

2.2 Code Submit

For easier tracking of modification, please follow the submission format below:

[Fix/New/Modify]: summary

1. commit message

Change-ID
Signed-off-by: xxx <xxx@company.com>

To be noted:

We also provided a commit template for your convenience:

$ git config --global commit.template ./.commit-template