工具开源

legged_control

qiayuanl

GitHub 仓库 qiayuanl/legged_control

类别
框架与工具 · 工具
开放程度
开源
发布时间
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。版本更新后命令可能变化,以官方文档为准。

作者已停止支持本项目,正在开发全新的框架。

  1. 克隆 legged_control

    旧账号名,现仓库是 qiayuanl/legged_control

    git clone git@github.com:qiayuanliao/legged_control.git
  2. 克隆 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
  3. 编译 OCS2

    官方说大约要十分钟

    catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo
    catkin build ocs2_legged_robot_ros ocs2_self_collision_visualization
  4. 编译 legged_control

    仿真包别在机载电脑编译;真机另编 legged_unitree_hw

    catkin build legged_controllers legged_unitree_description
    catkin build legged_gazebo
  5. 启动仿真并加载控制器

    真机把仿真换成 legged_unitree_hw.launch

    export ROBOT_TYPE=a1
    roslaunch legged_unitree_description empty_world.launch
    roslaunch legged_controllers load_controller.launch cheater:=false
  6. 启动控制器

    真机上不能启动 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.md

README 和 issue 里确认过的机器人

名称Gazebo 仿真真机部署
Unitree A1✓✓
Unitree Go1作者在 issue #8 确认来源:Issue #8—✓

✓ 官方资料写明支持,— 资料没写。没写不等于不支持。

常见报错

解法来自官方文档、维护者回复或提问者确认,部分报错出自旧版本。

unknown frame map

解决把 RViz 的 Fixed Frame 设为 odom

来源:Issue #5
could not retrieve one of the required parameters: loop_hz or cycle_time_error_threshold or thread_priority

原因节点和参数的命名空间不一致

解决让节点和参数使用同一个命名空间

来源:Issue #22
Unknown CMake command "FetchContent_Declare".

原因Ubuntu 18.04 不受 OCS2 支持

解决换到作者使用的 Ubuntu 20.04 环境再编译

来源:Issue #1
Imported target "Boost::system" includes non-existent path "/include"

解决把 ocs2_coreConfig.cmake 第 96 行 _include_dirs 末尾的 /include 改成 include

来源:Issue #25

适配机器人

  • Unitree A1

获取方式

相关概念

数据来源

本页信息均整理自以下公开资料。

7 条来源核验于 2026-10-01

星标、下载量等指标定期自动更新。

legged_control:安装步骤、环境要求与常见报错 | 具身集