ALT_HOLD vs DEPTH HOLD

Hi everyone!
I am a student who is working with a BLUEROV2.
I recently developed a code to arm the vehicle and set it in “DEPTH HOLD” mode in QGC using the Pymavlink library.
I attach the code:

master = mavutil.mavlink_connection('udpin:0.0.0.0:14440') #Create connection if QGC open

boot_time = time.time()

master.wait_heartbeat()
...
if (not attitudeControl.is_armed(master)):
		master.mav.command_long_send(1,master.target_component,mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM,0,1, 0, 0, 0, 0, 0, 0)
		print("Waiting for the vehicle to arm")
		master.motors_armed_wait()
	print('Armed!')
...
master.set_mode('ALT_HOLD')

The problem is that when I run the code it returns “Unknown mode ALT_HOLD”.
So I was wondering if the “ALT_HOLD” parameter is deprecated (although this parameter is used in the example on Ardusub) and if now a new parameter like “DEPTH HOLD” is used as used in this example and as defined here.
If it can be useful for solving this problem, I’m using QGC v.4.2.3

Hi @_martinareds,

ALT_HOLD is the correct internal name for the depth holding behaviour - depth is just considered as a negative altitude relative to the surface.

I suspect the issue here is actually with how the received heartbeats are being handled by pymavlink. Could you try explicitly waiting for the autopilot heartbeat, as discussed here?