CHANGE MODE FAILED

I used the example of change flight mode, in order to change to STABILIZE mode, but the terminal printed ‘Command executed, but failed’.

Even though I had changed the firmware to ardusub, I printed MAV_TYPE and found that it was ‘fixed wing’, not ‘submarine’.

from pymavlink import mavutil

import time
# Create the connection
# Need to provide the serial port and baudrate
master = mavutil.mavlink_connection(
            '/dev/ttyACM0',
            baud=115200)

mav_type=master.field('HEARTBEAT', 'type', master.mav_type)

print(mav_type)

The above program prints 1, and the following figure shows that this is a fixed wing.

How do I solve this problem?Thank you.

Hi,

Probably is triggering a failsafe, check the sensor status and try to set stabilize mode via QGC.

Add master.wait_heartbeat() before checking the field, it’ll print 12 (MAV_TYPE_SUBMARINE).

Thank you very much!!!
Your reply helped me solve this problem perfectly!!!

1 Like

Hi,

I’m glad that everything went well, let us know if you need any further help.

1 Like