Skip to content

Install using Docker

Docker images that include the neccessary software and dependencies have been created for convenience.

Requirements

  1. Install Docker using installation instructions.

  2. Complete the Linux Postinstall steps to allow you to manage Docker as a non-root user.

  3. If you have an NVIDIA graphics card, it can help speed up rendering. Install nvidia-container-toolkit.

    1. Follow Installation steps for Ubuntu (currently 3 steps)
    2. Skip down to Configuration and run nvidia-ctk to set up the nvidia container runtime

Use Existing Image on DockerHub

MBARI maintains Docker images for the two most recent releases on their DockerHub: - mbari/mbari_wec:latest - mbari/mbari_wec:previous

  1. 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
    

  2. 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
    

  3. To have another window running the same docker container, run this command in a new terminal:

    ./join.bash mbari/mbari_wec:latest
    

Build from Dockerfile

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.

  1. 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/
    

  2. Build the docker image If you have an NVIDIA graphics card

    ./build.bash mbari_wec
    
    Otherwise
    ./build.bash mbari_wec --no-nvidia
    

  3. Run the container If you have an NVIDIA graphics card

    ./run.bash mbari_wec_nvidia
    
    Otherwise
    ./run.bash mbari_wec_no_nvidia --no-nvidia
    

  4. To have another window running the same docker container, run this command in a new terminal:

    ./join.bash <name of image>
    
    where the name of the image is one of mbari_wec_nvidia or mbari_wec_no_nvidia

Quick start

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

Logs from the run will be saved to /logs in the container which is mapped to ~/mbari_wec/docker/logs on the host. These logs will be in the same CSV format as generated by the physical buoy. You may also collect rosbags in the /logs folder in the container. The rosbags collected in the sim will also be the same ROS 2 messages collected on the physical buoy.

Run an example to test

  1. In a new terminal (whether on host machine or in Docker container), source the workspace

    . ~/mbari_wec_ws/install/setup.bash
    

  2. Launch the simulation

    ros2 launch buoy_gazebo mbari_wec.launch.py
    

The simulation software should now be available. To run and test, proceed to the Run the Simulator tutorial series.