How to change the Target Altitude

HI,
I am a Chinese student and I know about ardusub recently.I want to know how can I use the built-in PID controller in QgroundControl to achieve depth control and How can I input the depth that I want to set?
Thanks a lot

Hi @cxs, welcome to the forum! :slight_smile:

QGroundControl (QGC) doesn’t do any actual control - it sends mavlink messages to ArduSub about what’s desired, and ArduSub uses various control loops to achieve that. For depth control you can use QGC to tell ArduSub to enter “depth hold” mode, which then uses a PID loop to maintain the depth the ROV was at just after the last pilot throttle input. When controlling the ROV via QGC it has to actually be at the depth you want to maintain in order to set that as the target depth.

You can either pilot the ROV to the desired depth and turn on depth hold mode in QGC, or you can use mavlink messages directly to set the target depth.

To set the depth using mavlink you should be able to use the SET_POSITION_TARGET_GLOBAL_INT message while in depth hold mode (there’s support for it in the ArduSub source). I couldn’t find a more recent example than @williangalvani’s gist from a while ago, so I’m not sure if that code will actually work in ArduSub >=4.0 (it was written for a specific version of ArduSub 3.6), but I’ll try to see if we can get an updated version added to our pymavlink documentation. I’ve created a GitHub issue about it here: