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

No retry docking #87

Merged
merged 2 commits into from
May 25, 2024
Merged

Conversation

bodop
Copy link
Contributor

@bodop bodop commented May 15, 2024

My garden is so small, that the mower does not need to charge to complete the mowing area. So I decided to place the base station in an unreachable place and recorded a dummy docking location instead. Obviously docking will never succeed. So I created the possibility to configure no retries. In addition it turned out, that even one configured retry ended in an infinite loop.

@ClemensElflein
Copy link
Owner

Thank you for the PR, LGTM

@ClemensElflein ClemensElflein merged commit 883b5c4 into ClemensElflein:main May 25, 2024
1 of 3 checks passed
@@ -203,8 +203,8 @@ Behavior *DockingBehavior::execute() {
return &IdleBehavior::INSTANCE;
}

// Reset retryCount
reset();
// Reset retryCount here would cause an infinite loop
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ClemensElflein @bodop Are you sure about this? If retry_count is 0 and the dummy docking approach point is not reachable then should never get here.

I don't think the regular docking behaviour logic should be changed to accommodate a special case such as this. Would be better to add a new "disable_docking" param and just immediately return IdleBehavior.

Copy link
Owner

Choose a reason for hiding this comment

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

As I see it, the change does not have anything to do with the PR, it's a general docking loop issue, if reset() is called in line 207, then retryCount is always 1 in line 222, so for non-zero retries, the thing would always retry.

Copy link
Owner

Choose a reason for hiding this comment

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

Usually I'd agree with the "lets not add some weird behavior for a specific use case"-statement, but making the parameter value '0' valid seems ok to me.

Copy link
Collaborator

@olliewalsh olliewalsh May 28, 2024

Choose a reason for hiding this comment

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

ok but changing the retry logic for dock_straight? This has changed the number of dock_straight attempts from 1 + config.docking_retry_count to 1 + (config.docking_retry_count - approach_attempts).

Don't understand how this can cause an infinite loop if docking_retry_count is 0. It would try dock_straight once and fail to Idle.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, missed the prev comment. Ok, so it's to stop a Docking -> Undocking -> Docking loop when retry count > 0

Copy link
Collaborator

@olliewalsh olliewalsh May 28, 2024

Choose a reason for hiding this comment

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

Just replaces one issue with a different issue though. Now a bad approach can disable dock_straight retries. Maybe should count approach and dock_straight retries separately?

@bodop
Copy link
Contributor Author

bodop commented May 28, 2024

At least reset() in line 207 caused an infinite loop ignoring the number of configured retries. OK, I assumed, that approach_docking_point() always succeeds. Perhaps one should also add reset() after line 202.

"disable_docking" would be a different approach. My approach has the advantage, that it is simple and ends in a defined end position.

@olliewalsh
Copy link
Collaborator

At least reset() in line 207 caused an infinite loop ignoring the number of configured retries. OK, I assumed, that approach_docking_point() always succeeds. Perhaps one should also add reset() after line 202.

"disable_docking" would be a different approach. My approach has the advantage, that it is simple and ends in a defined end position.

ah, so you want it to move to the approach point and stop? What if the docking approach point is in a different isolated area?

@bodop
Copy link
Contributor Author

bodop commented May 28, 2024 via email

@olliewalsh
Copy link
Collaborator

Ok, so just want to skip the dock_straight stage. Why not just add a param to explicitly disable this?

Think you're correct about needing a reset() at 202 before returning to idle, plus the reset() at the end before returning to idle.

@bodop bodop deleted the no-retry-docking branch June 25, 2024 09:38
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.

3 participants