-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Centralize path handler logic in controller server #5446
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
base: main
Are you sure you want to change the base?
Conversation
|
@SteveMacenski before I go too far, can you take a quick look to make sure I am on the right track? I have only pushed the changes in nav2_controller, graceful_controller and RPP |
|
@mini-1235, your PR has failed to build. Please check CI outputs and resolve issues. |
|
I have spent some time reading into MPPI's path handler, I can see there are some improvements like #3659, #3443. Also, there is a related PR for RPP in #4763, maybe we need to check if these changes are applicable to all controllers? If yes, I guess it will be easier to move them in Controller Server I also noticed that the DWB/MPPI need the path from planner to find its goal, should we pass this plan via the setplan api or a new argument in computevelocitycommands? |
|
Hi, sorry to jump in here but just sharing my two cents: |
I think path_handler implementation from MPPI is more comprehensive as it also considers path up to inversion point. This would also be helpful when user uses Hybrid A* with reeds-shepp as the global planner. |
Thanks for sharing, I will try to implement this and compare with my current method |
|
@mini-1235, your PR has failed to build. Please check CI outputs and resolve issues. |
SteveMacenski
left a comment
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.
Sorry it took so long!
I agree with this general sentiment. I think it would be nice to review all the path handlers and make sure the key features of all are being respected in the server's implementation. There's a number of CI failures that should also be looked at, but I'm sure you know :-) |
Yes, I will continue this PR once #5496 and other future PRs targeting path handler are done |
145b2d9 to
ea45821
Compare
|
@mini-1235, your PR has failed to build. Please check CI outputs and resolve issues. |
|
@SteveMacenski I think you can start reviewing this when you have time, in the following days I plan to:
Things to debate:
I think this becomes problematic when enforce_path_inversion is set to true. In that case, the local goal ends up being the cusping point, and the robot may stop there once it satisfies the XY and yaw tolerances. Because of this, I believe we still need the global goal for the goal checker. But as @SteveMacenski suggested, we could add this directly into the simple goal checker, so by default the simple goal checker is checking both the global goal and local path length. Do you agree with this approach? @mamariomiamo
Previously, the transform tolerance in the controller server was obtained from
Before merging this, I also need to:
|
|
@mini-1235, your PR has failed to build. Please check CI outputs and resolve issues. |
|
OK will do! This is admittedly alot so this next round is going to be more high level.
Ah ok. That makes sense for the goal checker, though probably not the other elements right? When enforcing inversions is off, its the same either way since we just prune to the prune distance / costmap bounds. When is it enabled, then we prune to that which we want from the control algorithm's perspective, but not the goal checker.
Why not have it still acquire it from costmap2D, just stored and used at the controller server level? I suppose I prefer less parameters to more, but I'm OK either way.
Do both - first after the integrated distance, as long as that distance is within the costmap bounds. |
Yes, when it is on, the distance to the local goal can become very small. That's why I think this local goal is not suitable to use in the goal checker
For the controller plugins as well?
Not sure if I understand this, can you elaborate? |
Isn't that in effect what is done today?
Basically combine the two: navigation2/nav2_controller/src/path_handler.cpp Lines 134 to 146 in 3404f3a
|
|
A good suggestion I received today: It would be great to make the path handler itself a plugin so that other users can replace this implementation if they see fit. A nice side effect is it makes us have to think a bit more about the API interfaces for it to make sure its generally good for a broad range of purposes and include all the information for the APIs other implementations may want that we have access to. Another would be possibly changing the pruning distance to be proportional to time instead, to prune the distance set out by that time by the maximum velocity. That way it wasn't something that needed to be tuned for changing velocity limits. Finally, maybe it would be good to provide feedback about the current idx of the path we're on to use in the BT Navigator for computing ETA, path length remaining, and so forth. That way we handle the issue of path looping using the wrong index globally |
|
I will think about it and reply tomorrow |
…uit_controller.cpp Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
Signed-off-by: mini-1235 <[email protected]>
Signed-off-by: mini-1235 <[email protected]>
I was thinking about one edge case:
Leaving some of my thoughts here: |
Signed-off-by: mini-1235 <[email protected]>
|
This pull request is in conflict. Could you fix it @mini-1235? |
Signed-off-by: mini-1235 <[email protected]>
Signed-off-by: mini-1235 <[email protected]>
| <PipelineSequence name="NavigateWithReplanning"> | ||
| <ProgressCheckerSelector selected_progress_checker="{selected_progress_checker}" default_progress_checker="progress_checker" topic_name="progress_checker_selector"/> | ||
| <GoalCheckerSelector selected_goal_checker="{selected_goal_checker}" default_goal_checker="general_goal_checker" topic_name="goal_checker_selector"/> | ||
| <PathHandlerSelector selected_path_handler="{selected_path_handler}" default_path_handler="PathHandler" topic_name="path_handler_selector"/> |
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.
Add to other XMLs with the selector plugins like the default nav2pose?
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 am a bit confused about which XMLs I should update here. Looking at the other XMLs, it seems this is the only behavior tree that uses GoalCheckerSelector and ProgressCheckerSelector, so I only added it here. Should I add it to all the XMLs as well?
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.
There are others, but this is the other 'main' one I think you should add it to (also goal / progress checker) https://github.com/ros-navigation/navigation2/blob/main/nav2_bt_navigator/behavior_trees/navigate_to_pose_w_replanning_and_recovery.xml#L11-L12
| } | ||
|
|
||
| transformed_path.header.frame_id = target_frame; | ||
| transformed_path.header.stamp = input_path.header.stamp; |
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.
transformed_path.poses.reverse(input_path.poses.size();
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 guess you mean reserve?
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.
Yes :-) Sorry, that's my dyslexia speaking 😆
| if (rotation_idx <= idx + 1 && inversion_idx <= idx + 1) { | ||
| break; | ||
| } |
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.
Please explain in a comment
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 <= idx + 1, it means there cannot be a smaller index returned from the inversion/rotation check, otherwise a smaller index might exist, we just haven't checked it yet, I will add a comment
| return true; | ||
| } | ||
|
|
||
| unsigned int findFirstPathConstraint( |
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 some of this function can be simplified. For example, prev_valid seems like it could be replaced with simply idx > 1. When would we hit the line inversion_idx = std::min(inversion_idx, idx + 1); and idx+1 wouldn't be larger than the existing inversion_idx?
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 agree that prev_valid can probably be replaced with idx >= 1, that was likely an oversight when I implemented it.
When would we hit the line inversion_idx = std::min(inversion_idx, idx + 1); and idx+1 wouldn't be larger than the existing inversion_idx?
Probably the very first time an inversion is detected, since inversion_idx is initialized to the path size
Log an error if this happens and set the prune distance to be the sampling distance in that case to make sure that's not possible. |
Co-authored-by: Steve Macenski <[email protected]> Signed-off-by: Maurice Alexander Purnawan <[email protected]>
I don't think we could do that though. The rotation shim controller doesn't have access to the |
Signed-off-by: mini-1235 <[email protected]>
|
When debugging, I encountered an issue with RPP (all default value): Dec.10.2025.Video.mp4The robot enters the ps: I noticed that this didn't happen in the earlier version, maybe something wrong with my current implementation, I will double check again edit: I understand the issue now, fixed in 2b02d7d |
Signed-off-by: mini-1235 <[email protected]>
OK! Docs in the configuration guide would do the trick. Practically speaking, I don't see this being an issue. In the Rotation Shim controller, if the path isn't at least the forward sampling distance long, we could log something navigation2/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp Lines 238 to 241 in 2b02d7d
current_path_.poses.back(); is not close to global_goal then we know that is not the situation we're in, so we could long once a warning. We'd just need to pass that into the method / use a class member and then make sure everything is in a consistent frame to compare pose distances.
|
This PR continues the work in #4789
Fixes #4757
Fixes #4304