-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
RPP Dexory tweaks #4140
RPP Dexory tweaks #4140
Conversation
a6dce64
to
cdae9a0
Compare
@james-ward can you look at this and confirm its a suitable alternative? If so, I can fix up a small number of pendantic things I'd like to change here (remove AMCL dependency...) and merge it. Or if there are elements of your PR you think need to still be here, let me know and I can make sure to review them both as a pair |
LGTM. This is essentially what I had - the only difference is that I didn't force the path to always contain at least two points, as I wasn't sure if this would break some other behaviour (ie maybe the pruning of already passed points was necessary for correct behaviour of something else.) If that is not the case, this PR is good for me. I can test on our platforms if the two of you wish, but I can't do that until later in the week. |
The only other thing is that you might want to adapt the new test I wrote on my branch for the actual act of projecting off the end of the path? |
Great! @doisyg can you add that and rebase on |
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5) | |||
project(nav2_regulated_pure_pursuit_controller) | |||
|
|||
find_package(ament_cmake REQUIRED) | |||
find_package(nav2_amcl REQUIRED) |
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.
TODO Me: remove AMCL dep and use angles
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.
oh yeah forgot about than one and your eyes when you saw that we are still using the good old amcl angles utils
@@ -90,6 +90,7 @@ Note: The maximum allowed time to collision is thresholded by the lookahead poin | |||
| `rotate_to_heading_min_angle` | The difference in the path orientation and the starting robot orientation to trigger a rotate in place, if `use_rotate_to_heading` is enabled. | | |||
| `max_angular_accel` | Maximum allowable angular acceleration while rotating to heading, if enabled | | |||
| `max_robot_pose_search_dist` | Maximum integrated distance along the path to bound the search for the closest pose to the robot. This is set by default to the maximum costmap extent, so it shouldn't be set manually unless there are loops within the local costmap. | | |||
| `interpolate_curvature_after_goal` | Needs use_fixed_curvature_lookahead to be true. Interpolate a carrot after the goal dedicated to the curvate calculation (to avoid oscilaltions at the end of the path) | |
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.
Question for @doisyg @james-ward : Do you feel there's any reason to make this a parameterization or always be in play?
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 think it should always be in play - for two reasons.
First, it preserves the user's intent when they set the minimum carrot distance.
Second, it only engages in the last segment and fixes bad control behaviour - I don't see a downside to having it running.
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.
@doisyg if you agree, you can remove the param and make it the always-on behavior
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.
On that one, I would be a bit conservative and keep it as a parameter for a while, then changing it later to default true, and finally then removing it. A bit like with the former use_interpolation
.
I am only very confident for straight path.
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.
@james-ward can you give this a whirl and let us know what you think? He's testing this on straight-line paths in warehouses, so they don't end on curves (they use other algorithms for free space controlling). If so, we can simplify this a bit
Yes! @james-ward just the test of that commit james-ward@e9dd766, or all the added tests in your branch ? |
I think only that commit is relevant. The others were for internal functions that I created. |
nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp
Outdated
Show resolved
Hide resolved
nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp
Outdated
Show resolved
Hide resolved
I took a look, beyond the parameter remark, I think this is good to go. Once merged, I'll remove the AMCL bits myself. Without parameter:
With parameter
|
c62e584
to
a3b230b
Compare
Rebased on main and added / adapted your test @james-ward (testing full quadrant and no single pose path as we reject them now). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4140 +/- ##
==========================================
- Coverage 90.01% 89.87% -0.15%
==========================================
Files 432 432
Lines 19406 19431 +25
==========================================
- Hits 17469 17463 -6
- Misses 1937 1968 +31 ☔ View full report in Codecov by Sentry. |
LGTM pending doc fix and if @james-ward responds to #4140 (comment) |
I'll give it a run this afternoon. |
I'm afraid I wasn't able to test this. We've had to run my patch up until now to make our platforms drivable, and the mainline has diverged enough that this wasn't just a simple update, keeping the other plugins and configs the same. I could not get the platform to move at all. I will have another look on Monday. |
Thanks, I really appreciate your time here. Making sure all the stakeholders are happy and not going to come back in 3 weeks because we made an error saves us all frustration by having to context switch back 😄 |
This PR does have the effect of projecting the carrot, but it is not smooth. There are big jumps in the projected position. So it isn't keeping the look ahead distance constant as is desired. Above video is live from our platform. This is because the current robot position is assumed to be the second last pose in the path (https://github.com/ros-planning/navigation2/blob/a3b230bb0ed0adac1b4ebb976437eb9e8b7a568e/nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp#L354), not its actual position. So the carrot will jump ahead by the spacing of the poses in the path. For big spacings this will result in jumpy carrot movement. |
Hi @james-ward, fair enough, we have been using paths/plans with small spacing, hence it works smoothly for us.
An easy workaround would be to use a denser plan. A full solution will be to interpolate between the pose of the plan. Maybe as a separate PR on top of this one ? WDYT ? |
The robot position is (0,0) because the So before the last segment, calling But this PR introduces different behaviour in the last segment. It finds the length of the last segment, subtracts it from the look ahead distance and then projects the carrot past the segment end by the remaining amount. For a robot at/very near the goal pose, the actual look ahead will end up being the desired lookahead minus the last segment length. I think that because you force the controller to not drop the second last pose in the path even when the robot has passed it, you could just call the |
@doisyg I have made the changes necessary to keep the carrot at the correct look ahead distance. It clearly wasn't correct before as the tests were looking for distances that were different from the look ahead distance. My commit is here: |
Do we suppose that closes the loop on this feature? I'm defaulting to whatever you both come to an agreement on for this one - I trust your opinions 😄 |
It does from my point of view. I have been running that latest patch since last week and it is good for us. |
@doisyg I know you're in Florida, so take your time, but let me know and push the update if appropriate! 😄 |
@doisyg, your PR has failed to build. Please check CI outputs and resolve issues. |
Thanks a lot @james-ward @SteveMacenski for you patience, and sorry that my iterations are a bit slow. |
Signed-off-by: Guillaume Doisy <[email protected]>
…uit_controller.cpp Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Steve Macenski <[email protected]>
Signed-off-by: Guillaume Doisy <[email protected]>
This guarantees that the look ahead distance is maintained Signed-off-by: James Ward <[email protected]>
Signed-off-by: Guillaume Doisy <[email protected]>
and rebased on |
@doisyg, your PR has failed to build. Please check CI outputs and resolve issues. |
@james-ward we all happy with this now? Can you give it one last whirl around? Then we can merge! |
I'll try it this morning. Stand by... |
Have confirmed it is good on our platform. Send it!! |
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.
@doisyg I don't see when reject_unit_path
is ever used. Can this be removed?
Otherwise LGTM and I can come through afterwards on replacing the AMCL dependency
* RPP Dexory tweaks Signed-off-by: Guillaume Doisy <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp Signed-off-by: Steve Macenski <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp Signed-off-by: Steve Macenski <[email protected]> * projectCarrotPastGoal test Signed-off-by: Guillaume Doisy <[email protected]> * Use circleSegmentIntersection when projecting past end of path This guarantees that the look ahead distance is maintained Signed-off-by: James Ward <[email protected]> * lint Signed-off-by: Guillaume Doisy <[email protected]> --------- Signed-off-by: Guillaume Doisy <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: James Ward <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]> Co-authored-by: Steve Macenski <[email protected]> Co-authored-by: James Ward <[email protected]>
* RPP Dexory tweaks Signed-off-by: Guillaume Doisy <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp Signed-off-by: Steve Macenski <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp Signed-off-by: Steve Macenski <[email protected]> * projectCarrotPastGoal test Signed-off-by: Guillaume Doisy <[email protected]> * Use circleSegmentIntersection when projecting past end of path This guarantees that the look ahead distance is maintained Signed-off-by: James Ward <[email protected]> * lint Signed-off-by: Guillaume Doisy <[email protected]> --------- Signed-off-by: Guillaume Doisy <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: James Ward <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]> Co-authored-by: Steve Macenski <[email protected]> Co-authored-by: James Ward <[email protected]> Signed-off-by: enricosutera <[email protected]>
* RPP Dexory tweaks Signed-off-by: Guillaume Doisy <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp Signed-off-by: Steve Macenski <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp Signed-off-by: Steve Macenski <[email protected]> * projectCarrotPastGoal test Signed-off-by: Guillaume Doisy <[email protected]> * Use circleSegmentIntersection when projecting past end of path This guarantees that the look ahead distance is maintained Signed-off-by: James Ward <[email protected]> * lint Signed-off-by: Guillaume Doisy <[email protected]> --------- Signed-off-by: Guillaume Doisy <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: James Ward <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]> Co-authored-by: Steve Macenski <[email protected]> Co-authored-by: James Ward <[email protected]>
* RPP Dexory tweaks Signed-off-by: Guillaume Doisy <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp Signed-off-by: Steve Macenski <[email protected]> * Update nav2_regulated_pure_pursuit_controller/src/parameter_handler.cpp Signed-off-by: Steve Macenski <[email protected]> * projectCarrotPastGoal test Signed-off-by: Guillaume Doisy <[email protected]> * Use circleSegmentIntersection when projecting past end of path This guarantees that the look ahead distance is maintained Signed-off-by: James Ward <[email protected]> * lint Signed-off-by: Guillaume Doisy <[email protected]> --------- Signed-off-by: Guillaume Doisy <[email protected]> Signed-off-by: Steve Macenski <[email protected]> Signed-off-by: James Ward <[email protected]> Co-authored-by: Guillaume Doisy <[email protected]> Co-authored-by: Steve Macenski <[email protected]> Co-authored-by: James Ward <[email protected]>
Basic Info
Description of contribution in a few bullet points
This is me finally contributing back after rebasing and testing with latest main the RPP tweaks that we have been using for months in production.
Warning, we only use RPP for linear paths, so caution when generalizing the usage of the added feature.
interpolate_curvature_after_goal
(default false) that interpolates a carrot after the goal in order to maintain a constant curvature lookahead distance. This is to avoid instabilities at the end of the path on the generation of the angular speed. The carrot used for the linear speed computation stays the same.interpolate_curvature_after_goal
is true. It required to modify a bit the path handler logic to be sure to keep at least 2 poses on the pruned plan.use_fixed_curvature_lookahead: true
curvature_lookahead_point
similarly tolookahead_point
for visualisation2024-02-23.16-18-43.mp4
use_rotate_to_heading
andallow_reversing
(addedx_vel_sign
parameter toshouldRotateToPath
for that). Souse_rotate_to_heading
can now be used backward.These 2 tweaks are a bit intertwined, hence contributing them together. This may be partially redundant with #3788 @james-ward
Description of documentation updates required from your changes
Future work that may be required in bullet points
For Maintainers: