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 thisproject 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