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

Call reset on new plan, not new goal #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mintar
Copy link
Contributor

@mintar mintar commented Jan 30, 2019

The documentation on reset() says:

called at the beginning of every new navigation, i.e. when we get a
new global plan

The reset() functions were called in setGoalPose(), i.e. when the user gives a new goal. However, when the local planner fails and the global planner replans, setGoalPose() is not called, but setPlan() is. This PR makes sure that reset() is also called in this case.

@DLu
Copy link
Collaborator

DLu commented Feb 4, 2019

So this is a case where I forgot to update the documentation as the interfaces evolved. It should have said new global goal, which was only detected when the global plan's last endpoint shifted. I changed it to make it more explicit.

Do you have a use case where you want things to be reset per-global-plan?

@mintar
Copy link
Contributor Author

mintar commented Feb 4, 2019

I changed it to make it more explicit.

Where? I guess not pushed yet?

Do you have a use case where you want things to be reset per-global-plan?

Hmmmm... I thought I did: I wrote a Critic that scores the distance to an intermediate goal, and remembers which intermediate goal poses have already been reached to stop oscillations between two intermediate goals. This list of reached goals is cleared on reset(). Since it's somehow related to the current plan, I was surprised that reset() wasn't called.

Upon reflection, it's even better to reset this list per-goal, not per-plan: If I set the global planner to continually replan, it would otherwise reset my list too often. So I'm closing this issue now.

@mintar mintar closed this Feb 4, 2019
@DLu
Copy link
Collaborator

DLu commented Feb 4, 2019

Sorry, dangling reference. It here refers to me the nav_core2 interface. I believe I wrote that comment before there was an explicit setGoal function in the local planner interface. I'll update the comment accordingly soon.

@DLu
Copy link
Collaborator

DLu commented Jul 2, 2020

Following up on the comments here

@mintar My thinking is that the critics already have access to the global plan via the prepare method. Do you basically want a version of RotateToGoal critic that resets when there is a new global plan?

@mintar
Copy link
Contributor Author

mintar commented Jul 3, 2020

My thinking is that the critics already have access to the global plan via the prepare method.

The trouble with that is, that the prepare method is called with the transformed global plan:

if (!critic->prepare(local_start_pose, velocity, local_goal_pose, transformed_plan))

Thus, the critic will be called with a different global plan on each iteration, and it is not trivial to figure out when there is an actual new global plan was send. It would require to align the transformed plan from the previous iteration with the current one and calculate the difference between them, and that's not even guaranteed to work if the two plans are similar within the current cost map window. It seemed much cleaner to me to explicitly call reset() on each new plan.

Do you basically want a version of RotateToGoal critic that resets when there is a new global plan?

Yes. That would fix the bug I described in this comment, but I suspect there might be more such bugs in other critics as well.

The current implementation is that reset() is only called when a global plan is triggered by a new global goal, as opposed to being triggered by replanning. The new behavior propsed here is to always call reset() on a new global plan, no matter what triggered it.

Can you come up with an example where the current behavior is more useful than the proposed one? I.e., where the critics should behave differently based on whether replanning or a new goal triggered the new global plan?

@mintar mintar reopened this Jul 3, 2020
mintar added 2 commits July 3, 2020 12:55
The documentation on `reset()` says:

> called at the beginning of every new navigation, i.e. when we get a
> new global plan

The `reset()` functions were called in `setGoalPose()`, i.e. when the
user gives a new goal. However, when the local planner fails and the
global planner replans, `setGoalPose()` is not called, but `setPlan()`
is. This commit makes sure that `reset()` is also called in this case.
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.

2 participants