Mavlink commands to set flight modes that are not listed

I would like to assign a button to Flowhold. Does anybody have the mavlink command and parameter list of different flightmodes? I guess this should be no big deal but I can’t find any reference.

You may check them from the source code
https://ardupilot.org/dev/docs/apmcopter-adding-a-new-flight-mode.html

1 Like

Thanks Alvin, thats alreay helpful.

Additional this is relevant:
https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_MODE

So I set Mavlink command “172”, Param1 “22” (for the Flowhold Flightmode in my case).

But nothing happens. I guess I need to send additional Param2 which contains “Custom Mode”. Does anybody have a reference how to set this parameter?

For reference here are the Plane/Quadplane modes listed:

You misunderstood the MAV_CMD_DO_SET_MODE command.
The first param Mode refers to MAV_MODE
which the second param is the flight mode.
So, you should enter
176
89 (works in my case)
22 (flowhold mode)

Hi,
I tried to do this using MAV_CMD_DO_SET_MODE and 92 MAV_MODE_AUTO_DISARMED

It comes with the reply saying the command is unsupported?

Why is that so? Also you mentioned you set 89. But as I check there isn’t any code 89 in MAV_MODE. Can I know where do you get the number?
https://mavlink.io/en/messages/common.html#MAV_MODE

this is my code

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

89 is a number I found from another forum a few years ago. It works on my Herelink so I shared it.

As mention in mavlink.io,

These defines are predefined OR-combined mode flags`.

So 89 should be a combination of multiple values.

I think MAV_MODE_AUTO_DISARMED not working is mostly due to the 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.