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

Rover: HOLD mode in AUTO will keep reversed flag #27309

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

robot-to-society
Copy link
Contributor

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

Copy link
Member

@IamPete1 IamPete1 left a 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).

Rover/system.cpp Outdated Show resolved Hide resolved
Rover/system.cpp Outdated Show resolved Hide resolved
@robot-to-society
Copy link
Contributor Author

robot-to-society commented Jun 16, 2024

@IamPete1 Thanks for your comment. I agree with your suggestion. I'll try it.

@rmackay9
Copy link
Contributor

rmackay9 commented Jun 17, 2024

Hi @robot-to-society, looking good! Can you squash all the Rover commits together?

@robot-to-society
Copy link
Contributor Author

@rmackay9 Thank you for review this PR. It squashed and change commit message a little bit. Is this OK?

@rmackay9
Copy link
Contributor

Hi @robot-to-society,

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!

@robot-to-society robot-to-society force-pushed the rover-resume-mission branch 2 times, most recently from 47ec83a to 1283a14 Compare June 17, 2024 06:30
@robot-to-society
Copy link
Contributor Author

@rmackay9 I think it's fixed now.

Copy link
Contributor

@rmackay9 rmackay9 left a 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) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.

Copy link
Contributor Author

@robot-to-society robot-to-society Jun 18, 2024

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.

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.

LGTM, thanks!

@peterbarker peterbarker merged commit b860949 into ArduPilot:master Jun 19, 2024
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants