Home        Store        Learn        Blog

External GPS Ardusub / Mavlink

Hello,
I have been working on starting up a new underwater project that will be using Ardusub. I’ve used it before, but never quite like this.

Typically, I’ve just used it in manual mode with a controller connected and I’ve been sending rc overrides through a mavlink/mavros connection to my sub and controlled it that way. Now, however, I want to include some of the nice autonomy features that Ardusub can do.

At the end of the day, I want to be able to select waypoints in QGroundControl then send them to the sub to follow autonomously. For my sub, I do some SLAM localization and get a starting GPS location, so I have what is essential a GPS sensor on board that can spit out GPS lat/lon. I want to feed this into Ardusub so it can use this information to do the waypoint navigation, preferable using mavros to send this gps data.

So, my questions are:

  1. How do I send Ardusub a GPS location that I know the sub is at?
  2. Once I’ve given it a GPS location, how do I tell it to start following these waypoints?

Any insight into this would be super helpful!
Thanks!

There are a great many of us eagerly awaiting an update with some of the coveted position-based features hinted on in the drop-down menu of QGC. Like position Hold, go to, return, etc.
We’re hoping that some of the brilliant minds and software engineers on this forum can help out the wonderful guys at BlueRobotics so something like what you and others seek can be released.

Good luck everyone!

1 Like

Ok, a few follow up questions then.

  1. I opened up QGC, dropped in some waypoints, turned on the Ardusub simulator, hit go, and it started following the waypoints. It did a poor job and was very slow, but it was roughly following the path, so what’s happening there?

  2. Doesn’t Ardupilot already have waypoint following? I thought that was one of the big draws to it in general was that you could pop in a waypoint and it would output some desired headings, and velocities to get there - possibly even motor controls if you have your motors configured correctly. If I’m able to provide the GPS coordinates, what else could be needed to follow the waypoints?

  3. Should I just drop the ardupilot thing altogether if it doesn’t have this capability? Is there another alternative?

Thanks!

Hello @tdoe, note that the autonomous features of ArduSub are not stable and not supported, but they are available for developers.

To send ArduSub a gps position via mavlink, you will want to use the GPS_INPUT mavlink message, and make sure your GPS_TYPE parameter is configured as MAVLINK. There are a couple examples on the ardusub.com page, see http://www.ardusub.com/developers/gps-positioning.html. These examples are focused on mavproxy and our companion image, but if you look into the source code you will find that it comes down to that GPS_INPUT mavlink message.

As far as sending waypoints in guided mode, I believe it’s done via SET_POSITION_TARGET_LOCAL_NED. Since you have it working in sitl, I would try to look at the communication going on between qgc and ardupilot and then go about replicating that. You can type the watch command in the mavproxy/sitl console to look at what messages qgc is sending and the message field values. If you need to find out exactly what is going on, I recommend digging into the source code of qgc and ardupilot.