legged_control
is an NMPC-WBC legged robot control stack and framework based on OCS2 and ros-control. To the author’s best knowledge, this framework is probably the best-performing open-source legged robot MPC control framework. Thanks to the ros-control interface, you can easily use this framework for your robot.
The source code is hosted on GitHub: qiayuanliao/legged_control.
# Clone legged_control
git clone git@github.com:qiayuanliao/legged_control.git
OCS2 is a huge monorepo; DO NOT try to compile the whole repo. You only need to compile ocs2_legged_robot_ros
and its dependencies following the step below.
- You are supposed to clone the OCS2, pinocchio, and hpp-fcl as described in the documentation of OCS2.
# Clone OCS2 git clone git@github.com:leggedrobotics/ocs2.git # Clone pinocchio git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git # Clone hpp-fcl git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git # Clone ocs2_robotic_assets git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git # Install dependencies sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev
- Compile the
ocs2_legged_robot_ros
package with catkin tools instead ofcatkin_make
. It will take you about ten minutes.Ensure you can command the ANYmal as shown in the document and below.catkin build ocs2_legged_robot_ros
Build the source code of legged_control
by:
catkin build legged_controllers
Build the simulation (DO NOT run on the onboard computer)
catkin build legged_gazebo
Build the hardware interface real robot. If you use your computer only for simulation, you DO NOT need to compile unitree_hw
(TODO: add legged prefix to the package name)
catkin build unitree_hw
- Set your robot type as an environment variable: ROBOT_TYPE
export ROBOT_TYPE=a1
- Run the simulation:
roslaunch unitree_description empty_world.launch
Or on the robot hardware:
roslaunch unitree_hw unitree_hw.launch
- Load the controller:
roslaunch legged_controllers load_controller.launch cheater:=false
- You can start the controller using
rqt_controller_manager
sudo apt install ros-noetic-rqt-controller-manager
rosrun rqt_controller_manager rqt_controller_manager
-
Start the
legged_controller
orlegged_cheater_controller
, NOTE that you are not allowed to start thelegged_cheater_controller
in real hardware! -
Set the gait in the terminal of
load_controller.launch
, then use RViz and other tools to control the robot
The table below shows the labs successfully deploy this repo in their real A1, feel free to open a PR for update these infos.
Lab | XPeng Robotics | Unitree | Geely Auto | Hybrid Robotics |
---|---|---|---|---|
Spend Time | 1 day | - | 3 hours | 2 hours |