ubuntu20.04仿真复现legged_control
复现legged_control
- 相关库安装
- 仿真界面操作
legged_control 是一个基于 OCS2 和 ros-control 的 NMPC-WBC 机器人控制栈和框架。
廖洽源githublegged control主页
相关库安装
git clone https://github.com/qiayuanl/legged_control.git # 克隆到本地
# 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
回到项目路径(src上一级目录)
catkin config -DCMAKE_BUILD_TYPE=RelWithDebInfo
catkin build ocs2_legged_robot_ros ocs2_self_collision_visualization
catkin build legged_gazebo
实物机器人采用下面这个(hw = hardware)
catkin build legged_unitree_hw
echo "source ~/leg/devel/setup.bash" >> ~/.bashrc # 添加到环境变量
source ~/.bashrc
roslaunch ocs2_legged_robot_ros legged_robot_ddp.launch # 启动一个例子
仿真界面操作
export ROBOT_TYPE=a1 # 设置仿真机器人类型
roslaunch legged_unitree_description empty_world.launch # 启动仿真空世界
# 加载控制器
# cheater = true 即初始化`legged_cheater_controller`
roslaunch legged_controllers load_controller.launch cheater:=false
# 安装相关工具
sudo apt install ros-noetic-rqt-controller-manager
rqt # 打开rqt工具
找到选项 Plugins–>Topics–>Message Publisher,然后打开/cmd_vel话题,这样机器人就站起来了
找到选项 Plugins–>Robot Tools–>Controller manager, 右键启动两个控制器,变成绿色。
找到选项 Plugins–>Robot Tools–>Robot Steering , 打开了速度控制条
接着导航栏这边主要修改成这样,odom,添加机器人模型add --> RobotModel,修改legged_robot_description。要显示足端轨迹就找到MarkerArray,打开相应的话题。
在输入了 roslaunch legged_controllers load_controller.launch cheater:=false,这个终端可以输入相应步态来控制机器人行走,比如trot走路,然后就可以用键盘控制运动了。