In this comment (from a while ago) @williangalvani was discussing the possibility of using the SET_POSITION_TARGET_GLOBAL_INT
or SET_POSITION_TARGET_GLOBAL_NED
messages for setting the depth to hold. I’m not sure if support has been added for that in ArduSub, or if you’d need to add it yourself, but if you’re able to use it then you’d be able to retrieve the target value with POSITION_TARGET_GLOBAL_INT
or POSITION_TARGET_GLOBAL_NED
respectively.