这个搞错了:这个是安装ros_gz_bridge的,不是安装gazebo的
AT:如果是安装的Harmonic,在安装ros_gz_bridge的时候要从源码编译
ros2完整版里面好像已经包含了gazebo的一个版本
包名应该就是叫ros-humble-ros-ign-gazebo
所以gazebo是作为一个普通的apt包安装的,不是作为ros2的包安装的
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.
-
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
-
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. -
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 issueCMake 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