Home        Store        Learn        Blog

Set target depth in Pixhawk using Pymavlink

I just started working on my AUV. I wanted to control it using python and pymavlink library.
How can make the rover stay at certain depth using the depth hold mode.
I can switch to “Stabilize” mode using pymavlink. But not in depth hold mode.

So, can anyone help to set the mode to “Depth Hold” and how to set the target depth

Hi Sakib,

You should be able to set “Depth Hold” mode, please check the ACK return to investigate the problem.
Also, you can check our pymavlink documentation for examples.

Depth hold requires an external pressure sensor like the Bar30 to be connected. If the sensor is not detected, or there is some problem with it, you will not be allowed to use depth hold.

Hi, Jacob.
Sorry for replying late.
We attached the Bar 30 and the depth hold mode is working fine. But we have another problem now. When the target depth is set, The ROV come around 2 feet above and then again goes down to that depth.
How can we hold the dept with maximum 5 inch error ?

There is some problems with depth hold mode. We are working on it:

In that case can we try something different.
In stabilize mode, we take the reading of depth sensor and then from the pymavlink(We are using an Odroid to control our AUV) and the manually throttle down the AUV. So it stays at perfect depth.

Hi Adnan,

Yes, it’s possible to do the manual alt control via pymavlink and creating your personal algorithm.

The better approach would be to make better code for depth hold in the firmware. The pymavlink approach will introduce unnecessary and unwanted latency.