Skip to main content
Version: 2025

2.3 ArduSub & ROSMAV

In this section, we explore ArduSub and rosmav. ArduSub is a fork of ArduPilot, a flight controller software that runs onboard the BlueROV2 through BueOS. The ArduSub software utilizes the MAVLINK communication protocol to control the motors, receive sensor data, etc. You will connect to the BlueROV2 through ROS 2 using a custom rosmav interface. This interface uses the MAVLINK communication protocal inside of a ROS 2 node to talk to the "frontseat" onboard the vehicle.

Installing ArduSub

For the purposes of this problem set and future simulations (with QGroundControl), you must install ArduSub. When you interface with the ROVs themselves, you'll connect to a SITL running onboard and therefore you will not need to run your own.

note

You must install ArduSub while you are in a virtual environment on the Raspberry Pi!

Open a terminal on the backseat and install ArduSub from our repository:

cd && git clone --recurse-submodules https://github.com/blksail-edu/ardupilot
cd ~/ardupilot

Then, create a new virtual environment for ArduSub:

mkvirtualenv ardusub

Installing the following python libraries into the ardusub virtual environment:

pip install empy==3.3.4 pexpect mavproxy future dronecan setuptools pyyaml

Also install the ccache system library and remove the modemmanager system library:

sudo apt install ccache -y
sudo apt remove modemmanager -y

Now, configure the ArduPilot repository:

./waf configure
. ~/.profile
./waf clean

With your favorite text editor, add the following commands to the .zshrc file on the backseat:

export PATH=$PATH:$HOME/ardupilot/Tools/autotest
export PATH=/usr/lib/ccache:$PATH

Source the .zshrc file and reactivate the ardusub virtual environment:

source ~/.zshrc
workon ardusub

Lastly, install the geographic library datasets:

cd && wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh
chmod +x ./install_geographiclib_datasets.sh
sudo ./install_geographiclib_datasets.sh

Testing ArduSub

In a terminal on the backseat, you may now start the software in the loop (SITL).

info

The first time you start the SITL, it may take up to 30 minutes to configure.

~/ardupilot/Tools/autotest/sim_vehicle.py --vehicle=ArduSub --aircraft="bwsibot" -L RATBeach --out=udp:192.168.3.1:14550

Installing ROSMAV

  1. First, create a new virutal environment for the rosmav interface.
mkvirtualenv rosmav --system-site-packages
workon rosmav
  1. Install the following libraries in the rosmav virtual environment.
pip install cv_bridge numpy pymavlink
  1. Now, clone the rosmav repository into the src directory of your auvc_ws.
cd ~/auvc_ws/src && git clone https://github.com/blksail-edu/rosmav
  1. Install ROS 2 dependencies for rosmav:
sudo rosdep init
rosdep update
cd ~/auvc_ws && rosdep install --from-paths src --ignore-src -r -y
sudo apt install ros-jazzy-ros-gz-bridge ros-jazzy-mavros-msgs
  1. Compile the rosmav package and source the workspace.
colcon build --packages-select rosmav && source install/setup.zsh

Launching ROSMAV

After building the rosmav package, test the interface by running the following command in a terminal on the backseat:

ros2 run rosmav bluerov2_hardware_interface
note

Make sure you are running ArduSub! In a new terminal, activate the virtual environment (workon ardusub) and run the simulation: ~/ardupilot/Tools/autotest/sim_vehicle.py --vehicle=ArduSub --aircraft="bwsibot" -L RATBeach --out=udp:192.168.3.1:14550

If the command runs successfully, you should see the following output:

[INFO] [1721669754.194733875] [ros_bluerov2_interface]: Heartbeat from system 1, component 0

Problem Set

For this problem set, please first create a new ROS 2 package named tutorial_ardusub to contain any new nodes that you create.

Problem One

In your tutorial_ardusub package, create a new node called bluerov2_sensors.py. This node should do the following:

  1. Subscribe to the battery sensor messages.
  2. Subscribe to the inertial measurement unit (IMU) sensor messages.
  3. Use attributes that are updated on subscription callbacks.
  4. Output a warning in the terminal when the battery has fallen below a safe voltage.
info

When both ArduSub and ROSMAV are running on the backseat, the SITL will send simulated messages that you can use to test your node.

Problem Two

Open QGroundControl on your Windows or macOs machine. You should see the BlueROV2 somewhere along the United State's west coast. This BlueROV2 is the SITL running on the backseat.

If it is not already running, start your node from Problem One.

In QGroundControl, arm the BlueROV2 and change its flight mode to GUIDED. Click any arbitrary point in the water and select Go to location. After holding down your space bar or dragging the slider, you should see the BlueROV2 moving.

Open a new terminal on the backseat and use the ros2 topic echo command on any of the available topics to inspect the messages being published to different topics. Also pay attention to your node. What do you observe?

Check-off

Review with a TA or instructor to check-off this section.