当前位置:   article > 正文

Hector Simulation 双足机器人仿真环境搭建

hector simulation

人形机器人移动的基础在于双足直立行走,而在真实环境下进行试验迭代,需要昂贵的硬件设备和较长的迭代周期,因此仿真试验环境显得尤为重要。在仿真环境下确定大致方向后,再进行实物试验,可以节约成本、缩短迭代周期。本文将介绍Hector Simulation双足机器人仿真环境的搭建和模拟。(操作系统:Ubuntu20.04;ros版本:noetic(gazebo11);底层架构:x86_64)

安装依赖

sudo apt-get install ros-noetic-controller-manager ros-noetic-ros-control ros-noetic-ros-controllers ros-noetic-joint-state-controller ros-noetic-effort-controllers ros-noetic-velocity-controllers ros-noetic-position-controllers ros-noetic-robot-controllers ros-noetic-robot-state-publisher ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control

下载源码并编译

  1. cd ~
  2. git clone https://github.com/DRCL-USC/Hector_Simulation.git
  3. mkdir -p ~/catkin_ws/src
  4. mkdir -p ~/catkin_ws/scripts
  5. cp ~/Hector_Simulation/Hector_ROS_Simulation/* ~/catkin_ws/src
  6. cd ~/catkin_ws
  7. catkin_make
  8. # 如果是首次编译,则加上下列参数
  9. # catkin_make -DCMAKE_BUILD_TYPE=Release

编译过程中可能遇到报错,是没有安装lcm包导致的,安装好再编译就不会出错了

  1. In file included from /home/wangml71/catkin_ws/src/hector_control/src/../include/common/../interface/../sdk/include/unitree_legged_sdk/unitree_legged_sdk.h:12,
  2. from /home/wangml71/catkin_ws/src/hector_control/src/../include/common/../interface/CmdPanel.h:38,
  3. from /home/wangml71/catkin_ws/src/hector_control/src/../include/common/DesiredCommand.h:15,
  4. from /home/wangml71/catkin_ws/src/hector_control/src/../include/common/ControlFSMData.h:4,
  5. from /home/wangml71/catkin_ws/src/hector_control/src/main.cpp:7:
  6. /home/wangml71/catkin_ws/src/hector_control/src/../include/common/../interface/../sdk/include/unitree_legged_sdk/lcm.h:9:10: fatal error: lcm/lcm-cpp.hpp: No such file or directory
  7. 9 | #include <lcm/lcm-cpp.hpp>
  8. | ^~~~~~~~~~~~~~~~~
  9. compilation terminated.

解决方案

  1. cd ~
  2. git clone https://github.com/lcm-proj/lcm.git
  3. cd lcm
  4. mkdir build
  5. cd build
  6. cmake ..
  7. make -j4
  8. sudo make install

加入环境变量

  1. vim ~/.bashrc
  2. #在.bashrc文件末尾添加下列代码
  3. source /opt/ros/noetic/setup.bash
  4. source /usr/share/gazebo-11/setup.sh
  5. source ~/catkin_ws/devel/setup.bash
  6. export ROS_PACKAGE_PATH=~/catkin_ws:${ROS_PACKAGE_PATH}
  7. export GAZEBO_PLUGIN_PATH=~/catkin_ws/devel/lib:${GAZEBO_PLUGIN_PATH}
  8. export LD_LIBRARY_PATH=~/catkin_ws/devel/lib:${LD_LIBRARY_PATH}

使能环境变量

source ~/.bashrc

运行测试

  1. #打开一个终端,运行下列代码
  2. roslaunch unitree_gazebo biped.launch
  1. # 另起一个终端,运行下列代码
  2. rosrun hector_control hector_ctrl

在gazebo仿真界面单击启动按钮,则可以看到机器人开始运行

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/925594
推荐阅读
相关标签
  

闽ICP备14008679号