Navigating an Autonomous Underwater ROV With GPS using ROS2 and Pymavlink

I am currently working on an autonomous underwater ROV using Ubuntu, ROS2, Pymavlink, and ArduSub. At the moment, I am using SITL for simulation using my laptop with Ubuntu OS.

My goal is to manually set waypoints using QGroundControl on my laptop, upload them to the ROV, and have ROS2 handle the control and execution of flight modes and others.

In SITL, everything works as expected—the ROV follows the waypoints I set. However, I’m unsure how to implement this in a real-world underwater scenario since GPS signals do not work underwater. Without GPS data, how can the ROV accurately navigate to predefined waypoints?

Additionally, I am uncertain about how to integrate this setup with my hardware, which includes a Pixhawk Holybro CM4 and a Ublox M8N GPS module with compass. Since the GPS will be ineffective underwater, what alternative positioning methods can be used?

I would appreciate any guidance or suggestions on how to approach this. Thank you!

Hi @itsJayMendoza -
Welcome to the forums!

To operate an ROV in the field, without GPS, you need a position source. This can be a DVL, or another localization system - see the DVL / localization tabs here.

Your GPS will work if it is above the water with the vehicle at the surface, but depending on what subsea hardware you’re using for the same purpose, handing off the position may be a bit tricky.

Are you using BlueOS? It may help significantly with developing things further - typically operating an ROV requires a companion computer for handling video and networking over the tether.

I’m not currently using BlueOS—can I still connect it with Pymavlink?

My goal is to develop a fully autonomous ROV that follows predefined waypoints. The ROV will navigate on the water’s surface and, upon detecting an obstacle, submerge to avoid it before resurfacing and continuing its path. Additionally, I want the ability to keep it submerged while traveling to a waypoint when necessary.

Can this functionality be implemented using BlueOS? Would it make the process easier? Also, I am using a Raspberry Pi as my main controller.

Thank you!

Hi @itsJayMendoza -
What version Pi are you using? BlueOS supports 3, 4 and 5 but it will take up the lowest percent of resources with a 5 of course.

Using BlueOS would not prevent you from using ROS and Pymavlink - it provides many of the features you would might need to setup anyways. Pymavlink alone should be able to connect and and communicate with your autopilot, but BlueOS and Mavlink2Rest may make aspects of your development easier.

Navigating at the surface with GPS and ArduSub should work without issue. If you’re using a DVL, you can typically set your coordinate system and then maintain approximate positioning when submerged, when in range of the bottom or a surface for the DVL to track. The AUTO mission functionality of ArduSub should “just work”!

Using the LUA script functionality that is a part of ArduSub / Ardupilot since v4.5 may make your entire project radically simpler. By enabling the SCR parameter, and just writing a short script, you can do things like have rangefinder values trigger actions like target depth changes, or jumping to a waypoint. You can see a bit of how that is done with a BlueBoat in this thread, and I’ve been working on this project (that will become a guide) to further detail just how easy it can be!

Do you have any documentation or a step-by-step tutorial on setting up BlueOS with ROS2 and Mavlink2Rest on a Raspberry Pi 4? That would be really helpful.

To be honest, I’m still new to this industry, so I’m not very familiar with these technologies yet. I’ll also need to research DVL and LUA scripting to understand because I’m not familiar with them also. Any guidance or recommended resources would be greatly appreciated.

Thanks again for your insights!

Hi @itsJayMendoza -
We don’t have a tutorial on that, mainly because it is pretty simple and documented adjacently!
To summarize:

  1. Install BlueOS on your SDcard. This sets up Mavlink2Rest
  2. Connect to BlueOS, and setup your vehicle type / connect the Pi to WiFi with internet access. Install the ROS2 extension.

You will need a Pi4, and to use this specific image that supports 64 bit only extensions like the ROS2 module.

Best of luck!