Install from source¶
Requirements¶
Ubuntu 24.04, ROS 2 Jazzy, Gazebo Harmonic¶
NOTE:
These are the current recommended requirements. Ubuntu 22.04, ROS 2 Humble, Gazebo Garden
instructions are no longer maintained for mbari_wec
as Gazebo Garden is EOL.
Follow instructions for Installing Gazebo with ROS.
-
Install ROS 2 Jazzy
MBARI WEC works best with the cyclonedds rmw implementation, so set that up as follows:
sudo apt install ros-jazzy-rmw-cyclonedds-cpp export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
Running the sim with rosbag2 logging uses mcap storage. We also need sdformat-urdf. So, install those as well:
sudo apt install ros-jazzy-rosbag2-storage-mcap ros-jazzy-sdformat-urdf
To use plotjuggler to view ros2 data live plots (recommended in these tutorials), install like so:
sudo apt install ros-jazzy-plotjuggler ros-jazzy-plotjuggler-msgs ros-jazzy-plotjuggler-ros
-
Install Gazebo Harmonic by installing
ros_gz
from theros-jazzy-*
apt repos.sudo apt update sudo apt install ros-jazzy-ros-gz
When using Gazebo Harmonic and ROS 2 Jazzy together, Gazebo packages (
gz-*
) now come from ROS 2 Jazzy apt repos (ros-jazzy-gz-*
). We also need to use thesdformat-urdf
package. See here for more info. -
Set the Gazebo version to Harmonic. (place this in ~/.bashrc for convenience if rebuilding often):
export GZ_VERSION=harmonic
-
gz-python-bindings
Python bindings for
gz.math
andgz.sim
are used inmbari_wec
but are not distributed via apt or pip. This repository, gz-python-bindings builds the python bindings and packages them up in a simplePyPI
index url for an easy pip install.- Ensure these packages are also installed
sudo apt update sudo apt install ros-jazzy-gz-sim-vendor ros-jazzy-gz-math-vendor
-
pip install
NOTE:
--break-system-packages
might sound scary, but don't be alarmed -- nothing bad will happen in this casepython3 -m pip install -i https://mbari-org.github.io/gz-python-bindings/simple gz-python-bindings --break-system-packages
-
Install necessary tools
sudo apt install python3-vcstool python3-colcon-common-extensions python3-pip git wget
-
Install necessary libraries
curl -s --compressed "https://hamilton8415.github.io/ppa/KEY.gpg" | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/ppa.gpg >/dev/null sudo curl -s --compressed -o /etc/apt/sources.list.d/my_list_file.list "https://hamilton8415.github.io/ppa/my_list_file.list" sudo apt update sudo apt install libfshydrodynamics=1.4.0
Buoy Simulation Software Build¶
-
Create a workspace, for example:
mkdir -p ~/mbari_wec_ws/src cd ~/mbari_wec_ws/src
-
Clone all source repos with the help of
vcstool
:wget https://raw.githubusercontent.com/osrf/mbari_wec/andermi/jazzy_harmonic/mbari_wec_all.yaml vcs import < mbari_wec_all.yaml cd ~/mbari_wec_ws
-
Install ROS dependencies
sudo pip3 install -U rosdep sudo rosdep init rosdep update rosdep install --from-paths src --ignore-src -r -y -i
-
Build and install
source /opt/ros/jazzy/setup.bash cd ~/mbari_wec_ws colcon build
The simulation software should build without errors. To run and test, proceed to the Run the Simulator tutorial series. Or run a quick test as described below to confirm all has worked as expected.
Run an example to test¶
-
In a new terminal, source the workspace
. ~/mbari_wec_ws/install/setup.bash
-
Set
SDF_PATH
to allowrobot_state_publisher
parse the robot description from the sdformat model (place this in ~/.bashrc for convenience if rebuilding often):
export SDF_PATH=$GZ_SIM_RESOURCE_PATH
-
Launch the simulation
ros2 launch buoy_gazebo mbari_wec.launch.py
Post-Build Environment Setup¶
Place these lines in your ~/.bashrc for convenience to simplify running the sim in the future:
```
source /opt/ros/jazzy/setup.bash
source /path/to/mbari_wec_ws/install/setup.bash
export GZ_VERSION=harmonic
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export SDF_PATH=$GZ_SIM_RESOURCE_PATH
```
(NOTE: Remember to replace /path/to/mbari_wec_ws/install/setup.bash
with your path to your mbari wec workspace)