ros2中gazebo安装的注意事项

2023-12-25 06:16:06

Install From source(推荐安装Fortress版本,好像很方便

ROS

Be sure you've installed?ROS Humble?(at least ROS-Base). More ROS dependencies will be installed below.

Gazebo

Install either?Edifice, Fortress, or Garden.(没有harmonic,我觉得最好还是使用Fortress版本好了,因为我安装了一个Harmonic版本出现了异常说是某个库找不到什么的)

Set the?GZ_VERSION?environment variable to the Gazebo version you'd like to compile against. For example:

export GZ_VERSION=edifice # IMPORTANT: Replace with correct version

You only need to set this variable when compiling, not when running.

Compile ros_gz

The following steps are for Linux and OSX.

  1. Create a colcon workspace:

    # Setup the workspace
    mkdir -p ~/ws/src
    cd ~/ws/src
    
    # Download needed software
    git clone https://github.com/gazebosim/ros_gz.git -b humble
    
  2. Install dependencies (this may also install Gazebo):

    cd ~/ws
    rosdep install -r --from-paths src -i -y --rosdistro humble
    

    If?rosdep?fails to install Gazebo libraries and you have not installed them before, please follow?Gazebo installation instructions.

  3. Build the workspace:

    # Source ROS distro's setup.bash
    source /opt/ros/<distro>/setup.bash
    
    # Build and install into workspace
    cd ~/ws
    colcon build
    

    If?colcon build?fails with?this issue

    CMake Error at CMakeLists.txt:81 (find_package):
      By not providing "Findactuator_msgs.cmake" in CMAKE_MODULE_PATH this
      project has asked CMake to find a package configuration file provided by
      "actuator_msgs", but CMake did not find one.
    
    cd src
    git clone git@github.com:rudislabs/actuator_msgs.git
    cd ../
    colcon build

文章来源:https://blog.csdn.net/geniusChinaHN/article/details/135189971
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。