-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add near collision cost and warnings for misaligned parameter settings in MPPI critics #4996
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
Conversation
|
This pull request is in conflict. Could you fix it @mini-1235? |
Codecov ReportAttention: Patch coverage is
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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'm not sure that this is equivalent or as performant as before, unfortunately! I think a good chunk of this may need to be reverted
|
Moving #4996 (comment) @SteveMacenski Thanks for looking into this PR!
Before submitting the PR, and again after your comment, I ran several experiments to better understand when this code segment is actually triggered. Let me share a little bit for my findings and my ideas behind this PR:)
I agree that this is not a 100% dead code, and maybe it is more suitable to call it as a logic error here, sorry for the confusion.
Before proceeding further with this PR, there are two points I would really appreciate your insight on:
Can you elaborate more on this? From the documentation side, I see that critical cost is described as "Cost to apply to a pose with any point in inflated space to prefer distance from obstacles.", That description made it seem reasonable to me that we should consider footprint cost during scoring. Also, using the footprint cost of
I ran this in a tb3 sim environment, and from the log, I saw when pointcost returns a I am a bit confused by this, and this is the third condition I mentioned above(I have always thought that if point cost returns If those questions are just my misunderstandings, I agree to close this PR:) |
Oh interesting. I think we should probably log a warning in this case, this should be loudly mentioned to make sure folks know that is the case that the robot information in the local costmap and settings in
Basically if we include the footprint cost, anywhere that the robot base has any point in the inflated 253 space, its always scored as 253 (max valid when using footprints). So if just one point on the robot is in that space, its the same as the robot driving up against a wall. Instead, if we score based on the center point-costs, then there's a penalization of proximity of the robot against the wall all the way until its basically touching. Also, that penalty is then directly scaling by the inflation layer's exponential function users tune - which could raise dramatically near obstacles or more gradually over space (so its tunable within that close-to-obstacles regime). This was a big reason that the Cost Critic was added and replaces the Obstacles Critic -- that used the distance which succomes to that exact problem always since the distance calculated from cost will always have the distance as the same when the footprint is touching 253 space. Maybe the docs need updating / clarification. Does that make sense?
Generally, yes, except for discretization situations where you're just barely touching the corner of a costmap cell that is 253 for the center cost and the ray-marching on the footprint's resolution is coarse enough to miss the bit that might in 254. Generally speaking, yes, if its "in" the inflated 253 space, the footprint should be 254. The exception to that is if the center point is just barely skirting the edge of the 253 inflated space, it can sometimes also return 253. if you run that again and have the robot squarely in the 253 inflated space, you should always see 254. |
Should we describe this kind of situation as near collision or in collision? |
|
Basically the 2 edge situations to think about are:
Then the obvious situations where the robot is in the collision by center cost and actually is; and robot's footprint collides with obstacle and we detect it. The edge cases are created by the fact that we're representing continuous space by a binning quantization (occupancy grid square cells), which both (a) obstacles can be at an arbitrary angle with respect to and (b) the footprint of the robot can be at any angle with respect to. There's some aliasing as an artifact of that quantization resolution choice. In actuality for the first case, the center point cost is the one that is wrong, not the polygonal check, since the far corner of the square cell is outside of the actual inflation radius (the radius is computed by cell center distances). In the second case, its up in the air about whether or not that could be considered slightly not a collision or slightly in collision, but either way they would be scored as highly costed or invalid, respectively. Its hard to say whether (a) the obstacle is misrepresented by the cell's aliasing or bininng of sensor data or (b) the iterator marching resolution barely misses detecting the colliding cell. Funny enough, questions like this and things like this are where its really obvious how much the graphics community and robotics overlap! I've taken inspiration from the graphics community a few times over the years in making robotics systems :-) Sorry, I know that was alot. But tl;dr is I think we should treat it as a near collision, since its likely just an artifact of square-cell aliasing angles and/or binning quantization |
No worries at all, I actually love hearing this kind of breakdown. Super insightful, and that really clarifies my questions. I think there are two things to be done based on #4361 and your explanations in this PR.
However, we could/should do these things to cost critic:
What are your thoughts on these? I think I can close this PR and open a new one for the second point? |
I think keep it and make it tunable with 253 as the default would be good! I don't think that would cause any issues with your assessment of the (3) cases for 253 being triggered to possibly lower it. I would add in a warning log if its set
Agreed! 👍
Agreed! 👍 A new PR probably makes sense! Though, you could just revert this work and force-push on this branch, if you like. I'm up for either :-) |
…llision Signed-off-by: mini-1235 <[email protected]>
ad4f1ec to
00f1a13
Compare
|
@mini-1235, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: mini-1235 <[email protected]>
|
@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.
LGTM! Just sanity check performance for me? If you add some print logs here when the critic is the cost critic, does the performance meaningfully change?
| critic->score(data); |
Signed-off-by: mini-1235 <[email protected]>
Signed-off-by: mini-1235 <[email protected]>
I have tested with default params, no performance change Link to docs: ros-navigation/docs.nav2.org#665 |
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.
Minor change and LGTM!
Signed-off-by: mini-1235 <[email protected]>
|
Should we backport this PR (except for the near collision cost change) to jazzy/humble? |
|
@mini-1235 we can backport fully to Jazzy since the default behavior of the parameter is the same. Humble I agree we should only backport the checks (I'm actually not sure if If you open those, I can merge those easily :-) Thanks for the back and forth and great analysis! |
|
Hi @SteveMacenski, I have backported it for both Jazzy and Humble, and I have tested it locally. I am not entirely sure why they are failing, I guess the CI is for Rolling only(?) |
|
Yeah its not currently setup for non-rolling builds at the moment |
Basic Info
Description of contribution in a few bullet points
Fix dead code as discussed in the issue
Description of documentation updates required from your changes
None
Description of how this change was tested
Tested on sim, cost of 253 works
Future work that may be required in bullet points
For Maintainers: