-
Notifications
You must be signed in to change notification settings - Fork 14.6k
MAV_CMD_DO_SET_MODE - add support #24704
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
Conversation
ace8435
to
5d1ed5f
Compare
@julianoes This now passes the formatting tests and build tests. Would be great if you could help me debug why it isn't returning the right ACK, as per #24704 (comment) (specifically, the code detects that a mode can't be sent, and then ACKs anyway). |
5d1ed5f
to
6681636
Compare
bump, what is the impetus? Should we merge? |
6681636
to
39f47b4
Compare
The blocker is that it returns the wrong ACK in the pre-existing checker code #24704 (comment) I was hoping for debug help from @julianoes to get this in since I can't see how it can be being set. I'll have another look though. |
How do I reproduce the problem? |
39f47b4
to
8a73f79
Compare
@julianoes Actually this does work. I was confused. I can set modes quite happy. It will return accepted for modes you might not expect, but I'm pretty sure that's because the base modes are valid. |
Do you think we might get this in v1.16 @julianoes - or is that really heading towards stable? |
I wouldn't know. If this is tested and low risk, then just make a backport pull request and tag me. |
Thanks! Done #25334 |
This adds support for
MAV_CMD_DO_SET_MODE
, which replaces SET_MODE (though I have not removed support for that)Literally all it does is publish the command, which is all that the
SET_MODE
message hander does in https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/mavlink/mavlink_receiver.cpp#L920-L946 too (after you factor out conversions).I have tested this and the mode can be changed. An ACK is received.
@julianoes would appreciate your advice here. The ACK is always accepted, even though it should be denied in some cases.
For example, I tried to trigger the default path here by passing an auto mode with an invalid submode - in this case:
mode: 29, custom_mode: 4,custom_sub_mode: 20
(20 is greater than the mode.When I run logging I can see that this is triggered, and
main_ret = TRANSITION_DENIED;
However further down this is tested to set the return value:
At this point
main_ret
has magically changed-1
, which is why this is accepted. I can't see it being set - advice?Upshot, I think my changes are good, but there is something wrong with the existing code.