Fix - #5094 rotation shim stateful goal checking#5140
Conversation
|
This pull request is in conflict. Could you fix it @PrabhavSaxena? |
|
@PrabhavSaxena, all pull requests must be targeted towards the |
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
96c0bdf to
9ddddfe
Compare
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
|
I don't think this works from the discussion in #5094 (comment) can you comment on that? |
The issue occurs because the rotation shim controller uses position-only tolerance checking to decide when to switch to rotation mode. However, due to localization shifts, if the robot briefly moves outside the XY tolerance during rotation, it switches back to the primary controller, causing oscillation. The change I've implemented uses the existing stateful behavior of goal_checker->isGoalReached().
This "memory" is exactly what's needed to solve the oscillation problem - once the controller enters rotation mode, it will stay there despite minor localization shifts. One potential concern might be that isGoalReached() also checks orientation. For a more complete solution, we might need to:
I'd appreciate your guidance on which approach would better align with the architecture of Nav2. |
I think this is what we should do ultimately. The goal checker that is given to the controller from the server can be any plugin considering any number of criteria. We can't rely on its implementation for internal controller behavior. We could essentially create a "stateful position goal checker" style object (or even that literal new plugin that we directly instantiate and use internally) to use in the controller to meet this need. |
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
I have added the plugin to check the position only. I have also added rotation_shim to internally use the same. Let me know if this works |
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
SteveMacenski
left a comment
There was a problem hiding this comment.
Last thing is that we need this PR to also target main so that Rolling, Jazzy, etc can have these changes also reflected. That way when you eventually upgrade, this is also included. All new features must be in main.
| * @class PositionGoalChecker | ||
| * @brief Goal Checker plugin that only checks XY position, ignoring orientation | ||
| */ | ||
| class PositionGoalChecker : public nav2_core::GoalChecker |
There was a problem hiding this comment.
Needs to be added in docs to this list with its configuration page: https://docs.nav2.org/configuration/packages/configuring-controller-server.html#provided-plugins. Here as well: https://docs.nav2.org/plugins/index.html.
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
|
Hi, I will resolve the comments right now, I had few questions about the same.
|
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
| primary_controller_->setPlan(path); | ||
| if (position_goal_checker_) { | ||
| position_goal_checker_->reset(); | ||
| } |
There was a problem hiding this comment.
For main we should also have the goal checker reset when we reset the controller (which happens at the end of a planning request https://github.com/ros-navigation/navigation2/blob/main/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp#L401-L405)
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
|
Signed-off-by: PrabhavSaxena <prabhavsaxena2003@gmail.com>
cool, got it :) |
nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp
Outdated
Show resolved
Hide resolved
…r.cpp Signed-off-by: Steve Macenski <stevenmacenski@gmail.com>
SteveMacenski
left a comment
There was a problem hiding this comment.
I look forward to the main PR :-)
I created a PR for the same (Pull request 5162) |
Basic Info
Description of contribution in a few bullet points
Description of documentation updates required from your changes
Description of how this change was tested
Future work that may be required in bullet points
For Maintainers: