Got COMMAND_ACK: DO_SET_MODE: UNSUPPORTED

Hi anyone knows why when I send the command to change mode, it return as unsupported?

the_connection.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
176, # command id,
0, # confirmation
80, #
0,0,0,0,0,0 # unused parameters for this command
)

I followed the code listed here is something that I did wrong?
https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_MODE
https://mavlink.io/en/messages/common.html#MAV_MODE

Probably due to safety settings in ardupilot, as mentioned in ardupilot wiki.

You can only arm or disarm in Stabilize, ACRO, AltHold, Loiter, and PosHold modes. You cannot arm your copter in AUTO mode.

Thanks for explaining. I just tried today and its true.
I realised it kept changing to Land Mode After landing.

I like to use mavlink to change it back to stabilize mode.

Do you know how do I find the basecode and subcode for the “do set mode” command? MAV_CMD_DO_SET_MODE

the command you are using is for px4.
for ardupilot you need to use custommode, and refer to the ardupilot docs

Hi, Thanks explaining. It kinda work but now there is another problem

the_connection.mav.command_long_send(
1, # autopilot system id
1, # autopilot component id
176, # command id, Set Mav Mode
0, # confirmation
0, #
0,0,0,0,0,0 # unused parameters for this command
)

I checked that the ardu custom code is 0 for stabilize mode. I am in land mode. Trying to use the above command to change to stabilize mode.

the reply was Got COMMAND_ACK: DO_SET_MODE: DENIED
How do I solve this? what is wrong why am i denied to change the mode?

Anyway I found the solution to this problem. In case anyone wants to know.

https://www.ardusub.com/developers/pymavlink.html

1 Like