-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAVLink: add support for the AVAILABLE_MODES
message
#28566
Conversation
const Mode* modes[] { | ||
#if MODE_AUTO_ENABLED | ||
&copter.mode_auto, // This auto is actually auto RTL! | ||
&copter.mode_auto, // This one is really is auto! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why copy-paste twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once is for auto RTL mode the other is for auto mode. Auto RTL is not a full mode, just auto mode with a some hacks so it presents as its own mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preliminary thoughts, will do a more thorough review tonight/tomorrow.
@@ -583,7 +583,8 @@ static const ap_message STREAM_EXTRA3_msgs[] = { | |||
#endif | |||
}; | |||
static const ap_message STREAM_PARAMS_msgs[] = { | |||
MSG_NEXT_PARAM | |||
MSG_NEXT_PARAM, | |||
MSG_AVAILABLE_MODES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What sets this rate, and did you consider making only send the mode on chance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can request the full list be sent where it would use this rate. QGC actually just requests the modes one at a time, so the stream rate doesn't really mean anything, it would be the SRx_PARAMS
parameter.
c40e5b7
to
f5862c9
Compare
|
It could be wrapped in an ifdef to reduce impact |
It could, but I think it should be defined in by default. This allows the GCS to accurately relay the modes the vehicle has. This is important on low flash boards where modes are likely to be removed to save flash. Plane vs Quadplane for example. |
f5862c9
to
f5f49f4
Compare
Very cool @IamPete1 Note, we recently merged the rtl and safety return standard modes, which may affect this mavlink/mavlink#2191 |
Thanks! Although we support the available modes stuff we don't do the standard mode thing yet. Everything is still "custom". But I think we will in the future. |
Thanks @IamPete1 . I'm hoping you do too - better for the GCS and for users. |
This message allows the GCS to get the list of available modes at runtime. In the future this allows things like #28110
This requires: ArduPilot/mavlink#374
This message is supported by the QGC daily build and has been tested using it.
For example if you connect to a plane without Quadplane enabled it will only show the fixed wing modes:

If you enable quadplane and re-connect you will then see all modes:

Current master shows a preconfigured subset of modes:

Editing a mode name in the cpp proves that it is updated with the new message:

Future work (not for this PR):
Fillout the message more completely:
MAV_MODE_PROPERTY
bitmask for each mode.MAV_STANDARD_MODE
enum for each modeReport the current mode with the new
CURRENT_MODE
messageSend
AVAILABLE_MODES_MONITOR
to allow the GCS to notice and re-request if the number of modes changes.Support
MAV_CMD_DO_SET_STANDARD_MODE
Addition of new modes from scripting and more.