Setup - CWRUbotixROV/ardupilot_gazebo Wiki

Install Dependencies

Update Packages

Run sudo apt update

Run sudo apt upgrade

Install gstreamer

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio

Install OpenCV

OpenCV Dependencies

sudo apt-get install cmake gcc g++ libavcodec-dev libavformat-dev libswscale-dev libgtk2.0-dev libgtk-3-dev python3-pip

If you are using a VM you may get the following message: "Media change: please insert the disc labeled...". In this case run sudo sed -i '/cdrom/d' /etc/apt/sources.list and rerun the previous command.

pip3 install numpy

Build OpenCV

git clone

cd opencv

mkdir build

cd build

cmake ..

Before moving on to the next step, first check the output of the cmake command. You should see a section titled "Python 3" with 4 lines following. You should see a folder path for "Interpreter", "Libraries", "numpy", and "install path". Take note of the "install path" which will look something like lib/python3.8/site-packages/cv2/python3.8. Scroll up through the output and look for a section title "GUI". Ensure that "GTK+" is marked as "YES". Scroll up and look for a line with "GStreamer: YES". If you have all of these lines in the output, move on to the next step of compiling OpenCV. This step may take up to an hour to run and will take a lot of CPU resources.

make -j4

sudo make install

Install OpenCV to Python Virtual Environment

If you do not have your virtual environment set up, first follow the instructions here: Now, the python library OpenCV created needs to be copied to the virtual environment.

  1. Find where OpenCV is installed. Take the path "install path" of the cmake output. Truncate the path so it ends with cv2. So, if the "install path" was lib/python3.8/site-packages/cv2/python3.8, then truncate it to lib/python3.8/site-packages/cv2. Then, add /usr/local/ to the beginning. In this case, it would become /usr/local/lib/python3.8/site-packages/cv2.
  2. Find the "site-packages" folder of your virtual environment. Activate the "rov" virtual environment. Run python3 -m site --user-site. The output of this command is the folder.

Now you will create a symbolic link between these two locations. Run ln -s <Path where OpenCV is installed> <Path of virtual environment site-packages>/cv2. For example, the command will look something like ln -s /usr/local/lib/python3.8/site-packages/cv2 ~/.virtualenvs/rov/lib/python3.8/site-packages/cv2.

Test Installation


import cv2

If there are no errors, then it has worked.

Install Gazebo

curl -sSL | sh

Set Up Ardusub

git clone

cd ardupilot

git submodule update --init --recursive

Tools/environment_install/ -y

. ~/.profile

Running SITL for the first time

cd ArduSub -w

Use ctrl-C to exit SITL


Build Gazebo plugins

Navigate back to your home directory.

git clone [email protected]:CWRUbotixROV/ardupilot_gazebo.git

cd ardupilot_gazebo

mkdir build

cd build

cmake ..

make -j4

sudo make install

Clone Gazebo Models

Navigate back to your home directory.

git clone [email protected]:CWRUbotixROV/gazebo_rov.git