This is the entrypoint for the wave energy harvesting buoy project.
See documentation here.
And MBARI-WEC in action using Gazebo simulator here:
These are the repositories for the project:
- mbari_wec_utils: ROS 2 messages, interface API, and examples for
receiving and sending data to a physical or simulated buoy.
- buoy_interfaces: ROS 2 messages to recieve and send data to a physical or simulated buoy
- buoy_api_cpp: C++ Interface to MBARI Power Buoy including Controller examples to run against a physical or simulated buoy.
- buoy_api_py: Python Interface to MBARI Power Buoy including Controller examples to run against a physical or simulated buoy.
- mbari_wec_gz
- buoy_description: Buoy model description.
- buoy_gazebo: Gazebo plugins, worlds and launch files to simulate the buoy.
There are two GitHub template repositories set up (cpp/python) for a quick start on writing a custom controller utilizing buoy_api_cpp and buoy_api_py. Please see cpp examples and python examples for example controller implementations.
At the moment, MBARI WEC is supported by source installation only. Use Ubuntu Jammy (22.04).
-
Install ROS 2 Humble (preferably binary installation)
MBARI WEC is tested against cyclonedds rmw implementation (default changed from Galactic to Humble)
sudo apt install -y ros-humble-rmw-cyclonedds-cpp export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
-
Install Gazebo Garden (preferably binary installation)
Installing the binaries for Gazebo is recommended, but if building Gazebo Garden from source, it is necessary to export the
PYTHONPATH
for gz-math python bindings when building the mbari_wec_gz repository below:export PYTHONPATH=$PYTHONPATH:<path to your gz-sim workspace>/install/lib/python
See gz-math Python Get Started tutorial. This step is needed until
PYTHONPATH
is automatically exported upstream, tracked in this issue -
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.3.1
-
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/main/mbari_wec_all.yaml vcs import < mbari_wec_all.yaml cd ~/mbari_wec_ws
-
Set the Gazebo version to Garden. This is needed because we're not using an official ROS + Gazebo combination:
export GZ_VERSION=garden
-
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/humble/setup.bash cd ~/mbari_wec_ws colcon build
-
Install Docker using installation instructions.
-
Complete the Linux Postinstall steps to allow you to manage Docker as a non-root user.
-
If you have an NVIDIA graphics card, it can help speed up rendering. Install nvidia-docker.
MBARI maintains Docker images for the two most recent releases on their DockerHub:
mbari/mbari_wec:latest
mbari/mbari_wec:previous
-
Get
run.bash
script.git clone -b main https://github.com/osrf/mbari_wec.git cd ~/mbari_wec/docker/
Or
wget https://raw.githubusercontent.com/osrf/mbari_wec/main/docker/run.bash chmod +x run.bash
-
Run the container
If you have an NVIDIA graphics card
./run.bash mbari/mbari_wec:latest
Otherwise
./run.bash mbari/mbari_wec:latest --no-nvidia
An alternative to using the images from MBARI's DockerHub would be to build from a Dockerfile. This is convenient if you would like to make any changes.
-
Clone the mbari_wec repository to download the latest Dockerfile.
git clone -b main https://github.com/osrf/mbari_wec.git cd ~/mbari_wec/docker/
-
Build the docker image
If you have an NVIDIA graphics card
./build.bash nvidia_opengl_ubuntu22 ./build.bash mbari_wec
Otherwise
./build.bash mbari_wec --no-nvidia
-
Run the container
If you have an NVIDIA graphics card
./run.bash mbari_wec
Otherwise
./run.bash mbari_wec --no-nvidia
-
To have another window running the same docker container, run this command in a new terminal:
./join.bash mbari_wec
Quick start scripts are provided in the home directory:
This sources the compiled workspace:
. setup.bash
This sources the compiled workspace and launches the simulation:
./run_simulation.bash
-
In a new terminal (whether on host machine or in Docker container), source the workspace
. ~/mbari_wec_ws/install/setup.bash
-
Set
SDF_PATH
to allowrobot_state_publisher
to parse the robot description from the sdformat model:export SDF_PATH=$GZ_SIM_RESOURCE_PATH
-
Launch the simulation
ros2 launch buoy_gazebo mbari_wec.launch.py
Make sure you have permissions to push to the MBARI organization on DockerHub. This permission is given by the MBARI administrator.
Build the mbari_wec
Docker image, as detailed above.
Find the image ID for mbari_wec
:
docker images
Tag the image with the destination name:
docker tag <IMAGE ID> mbari/mbari_wec:latest
Push to the mbari/mbari_wec
public image.
docker push mbari/mbari_wec:latest
You may have to log in for it to recognize your permissions:
docker login