- 类别
- 框架与工具 · 工具
- 开放程度
- 开源
- 发布时间
- 2022 年 6 月
- 开源协议
- BSD-3-Clause
项目简介
基于 OCS2 和 ros-control 的足式机器人模型控制框架,集成非线性模型预测控制(NMPC)、全身控制(WBC)、状态估计和 sim2real 流程,提供 Gazebo 仿真和宇树机器人硬件接口,可在数小时内部署到 Unitree A1,也能借助 ros-control 接口移植到自定义机器人,定位为足式机器人基于模型控制的基线。作者已停止维护,带感知的版本见 legged_perceptive。
legged_control 安装要点
来源:README.md依据官方资料的 master 版本整理,核验于 2026-11-06。版本更新后命令可能变化,以官方文档为准。
作者已停止支持本项目,正在开发全新的框架。
克隆 legged_control
旧账号名,现仓库是 qiayuanl/legged_control
git clone git@github.com:qiayuanliao/legged_control.git克隆 OCS2 及依赖
git clone git@github.com:leggedrobotics/ocs2.git git clone --recurse-submodules https://github.com/leggedrobotics/pinocchio.git git clone --recurse-submodules https://github.com/leggedrobotics/hpp-fcl.git git clone https://github.com/leggedrobotics/ocs2_robotic_assets.git sudo apt install liburdfdom-dev liboctomap-dev libassimp-dev编译 OCS2
官方说大约要十分钟
catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo catkin build ocs2_legged_robot_ros ocs2_self_collision_visualization编译 legged_control
仿真包别在机载电脑编译;真机另编 legged_unitree_hw
catkin build legged_controllers legged_unitree_description catkin build legged_gazebo启动仿真并加载控制器
真机把仿真换成 legged_unitree_hw.launch
export ROBOT_TYPE=a1 roslaunch legged_unitree_description empty_world.launch roslaunch legged_controllers load_controller.launch cheater:=false启动控制器
真机上不能启动 legged_cheater_controller
rosservice call /controller_manager/switch_controller "start_controllers: ['controllers/legged_controller'] stop_controllers: [''] strictness: 0 start_asap: false timeout: 0.0"
环境要求
来源:README.md- 系统来源:Issue #1
- Ubuntu 20.04 + ROS Noetic + Gazebo 11.10(作者在 issue #1 确认的环境)
- OCS2
- 只编译 ocs2_legged_robot_ros 及其依赖,不要编译整个仓库
- 构建工具
- catkin tools,不用 catkin_make
- 运行设备
- 作者建议用 NUC 这类外部计算设备运行
适配矩阵
来源:README.mdREADME 和 issue 里确认过的机器人
| 名称 | Gazebo 仿真 | 真机部署 |
|---|---|---|
| Unitree A1 | ✓ | ✓ |
| Unitree Go1作者在 issue #8 确认来源:Issue #8 | — | ✓ |
✓ 官方资料写明支持,— 资料没写。没写不等于不支持。
常见报错
解法来自官方文档、维护者回复或提问者确认,部分报错出自旧版本。
unknown frame map解决把 RViz 的 Fixed Frame 设为 odom
来源:Issue #5could not retrieve one of the required parameters: loop_hz or cycle_time_error_threshold or thread_priority原因节点和参数的命名空间不一致
解决让节点和参数使用同一个命名空间
来源:Issue #22Unknown CMake command "FetchContent_Declare".原因Ubuntu 18.04 不受 OCS2 支持
解决换到作者使用的 Ubuntu 20.04 环境再编译
来源:Issue #1Imported target "Boost::system" includes non-existent path "/include"解决把 ocs2_coreConfig.cmake 第 96 行 _include_dirs 末尾的 /include 改成 include
来源:Issue #25
适配机器人
- Unitree A1