Skip to content
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

GCS_MAVLink: Remove wrong usage of COMMAND_ACK message #14452

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

patrickelectric
Copy link
Member

@patrickelectric patrickelectric commented May 26, 2020

SET_MODE message does not exist inside the MAV_CMD enum
as described in the mavlink specification for COMMAND_ACK.
The system that is using SET_MODE to communicate with the
vehicle should rely on HEARTBEAT message to detect if
the mode was set correctly.

Signed-off-by: Patrick José Pereira [email protected]

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preserved the current insane behaviour in a refactor - thus that comment.

Have you checked apmplanner2 it may special-case this - I don't know? I know that it interprets command-acks.

I do know this will be a significant behaviour change for MAVProxy users as they won't get the feedback on success/failure they currently do - unless they have the console open. dronekit-python users likewise - it may break scripts.

I opened ArduPilot/pymavlink#411 several weeks ago as a move towards what you're doing in this PR :-)

Better by far to actually use the actual MAV_CMD_DO_SET_MODE - you get a legitimate ACK from that, and it can provide you a hint as to what's gone wrong and how permanent a thing it is. I believe APMplanner2 will actually interpret that CMD_ACK, too. That's no an infallible system; I really wish there was an opaque identifier in these commands.

@patrickelectric
Copy link
Member Author

Have you checked apmplanner2 it may special-case this - I don't know? I know that it interprets command-acks.

I have only checked with QGC team, I did a small discussion here about the usage of the deprecated command SET_MODE and move to the non deprecated alternative MAV_CMD_DO_SET_MODE.

If someone is using ACK_COMMAND to acknowledge SET_MODE, they are breaking the mavlink specification.
If ArduPilot continues to acknowledge SET_MODE, it enforces the break of the specification and the wrong usage of it, resulting in software that can not work with vehicles or any other system that follows the mavlink specification.

@magicrub
Copy link
Contributor

magicrub commented Jun 2, 2020

This effects GCSs. Has this been tested on MissionPlanner or QGC? @DonLakeFlyer @meee1

@rmackay9
Copy link
Contributor

rmackay9 commented Jun 2, 2020

We should test this against MP before merging.

@meee1
Copy link
Contributor

meee1 commented Jun 8, 2020

MP has never used this ack.

@magicrub
Copy link
Contributor

magicrub commented Jun 8, 2020

What about generating an immediate heartbeat on successful mode change?

@DonLakeFlyer
Copy link
Contributor

QGC doesn't use it

@peterbarker
Copy link
Contributor

peterbarker commented Jun 8, 2020 via email

@tridge
Copy link
Contributor

tridge commented Aug 18, 2020

for GCS that have been correctly updated to use the command this makes no difference
for GCS that have not been updated they need the ack
Note that pymavlink was only changed to avoid use of set_mode() quite recently
MissionPlanner still uses set_mode() and should change to use the command
qgroundcontrol still uses set_mode()
Until the GCS implementations all use the command instead of set_mode the ack/nack in the tlog is useful, even if the GCS doesn't display the ack/nack

@peterbarker
Copy link
Contributor

It sounds like this old, bad send-ack code is going to be with us for a very long time.

@patrickelectric did you want to keep this PR open for the next 3 years until everyone's moved away from the message to the command, or shall we close this and redo it in the future?

@peterbarker
Copy link
Contributor

Nudge @patrickelectric

@patrickelectric
Copy link
Member Author

We could close it, no problem.
I'll add an event in my calendar to update this PR in 3 years from now 😆

@patrickelectric
Copy link
Member Author

Less than 1 year to follow the MAVLink standard correctly.

@patrickelectric
Copy link
Member Author

patrickelectric commented Feb 1, 2024

After 4 years, @peterbarker I believe that is time to merge it.

SET_MODE message does not exist inside the MAV_CMD enum
as described in the mavlink specification.
The system that is using SET_MODE to communicate with the
vehicle should rely on HEARTBEAT message to detect if
the mode was set correctly.

Signed-off-by: Patrick José Pereira <[email protected]>
@tridge tridge merged commit 3f2c82d into ArduPilot:master Feb 19, 2024
92 checks passed
@patrickelectric
Copy link
Member Author

Thanks everybody!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants