-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Rover: HOLD mode in AUTO will keep reversed flag #27309
Conversation
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.
I wonder if we could make it work more generally. We have the is_autopilot_mode
method. Maybe we only reset if entering a autopilot mode which is not auto, and then we add a reset on mission start (IE not resume).
@IamPete1 Thanks for your comment. I agree with your suggestion. I'll try it. |
5728508
to
442f747
Compare
Hi @robot-to-society, looking good! Can you squash all the Rover commits together? |
573d5b1
to
d5a0f88
Compare
@rmackay9 Thank you for review this PR. It squashed and change commit message a little bit. Is this OK? |
Ah, it looks like the 1st commit changes both AP_Mission and Rover. There should be two commits, one that affects AP_Mission and the other Rover. I think you can handle git but if you want me to fix it up I can. Thanks! |
47ec83a
to
1283a14
Compare
@rmackay9 I think it's fixed now. |
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.
looks good, thanks!
Rover/mode.cpp
Outdated
@@ -44,7 +44,10 @@ bool Mode::enter() | |||
|
|||
// initialisation common to all modes | |||
if (ret) { | |||
set_reversed(false); | |||
// reset reversed for autopilot mode except auto | |||
if (is_autopilot_mode() && mode_number() != Mode::Number::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.
if (is_autopilot_mode() && mode_number() != Mode::Number::AUTO) { | |
init_reversed_flag() |
... and crate a virtual method on the Mode object which checks is_autopilot_mode
, and overridden by ModeAuto to check the is_resume flag.
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.
@peterbarker Thank you for your comment. I'm not sure if I understood your advice properly, but I fixed it. I tested with SITL and it worked perfectly for me.
1283a14
to
b55e128
Compare
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.
LGTM, thanks!
Currently, changing the hold mode from AUTO resets the reverse flag, which is not the correct behavior for a mowing mission that contains a DO_SET_REVERSE command. I would like to be able to maintain the reverse flag while the mower goes from AUTO -> HOLD -> AUTO.
This is a video tested in SITL.
https://drive.google.com/file/d/1QhU1QoM_vY50oIVMzYeWu1zqfvpIl-3N/view?usp=sharing