Assuming you’re referring to the SET_POSITION_TARGET_GLOBAL_INT
message (also used in our target depth example), yes, that should specify a target depth for depth hold to try to reach
Note that depth hold re-evaluates its target based on pilot input, so if you’re also controlling the vehicle with a joystick then any vertical input you provide will reset the depth target to your current depth.
The relevant fix is indeed merged in to recent ArduSub releases, including 4.5.1
Either should in principle work, although I have a vague recollection that it has previously been preferable to be in manual mode when arming, and switch to depth hold afterwards (possibly even once the vehicle is fully below the water level), so maybe try that as a starting point?
That said, there has been a previous report that switching to depth hold before arming may avoid an issue (which we weren’t able to substantiate at the time, so take it as you will).
All of ArduSub’s operation expects to be in water, and breaking that assumption tends to result in unexpected behaviour, while also not being representative of the behaviour during normal operation. I wouldn’t expect that to change the depth target, but it’s hard to say what the autopilot will try to do if its requested output isn’t achieving anything (short of walking through and analysing the source code, which I’m afraid I don’t currently have time for).
If you get a log of depth hold not working as expected in water then we can try to take a look at it and see if there’s a bug that needs fixing or something