-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[SMAC planner] inflation cost not respected on narrow corridor #4808
Comments
I just found the culprit. It's the same that makes me create the "cost_critic" instead of the "obstacle_critic". In narrow spaces, the Same quick fix, in navigation2/nav2_smac_planner/src/collision_checker.cpp Lines 154 to 161 in 8c2d301
By: float footprint_cost = static_cast<float>(footprintCost(current_footprint));
if (footprint_cost == UNKNOWN && traverse_unknown) {
return false;
}
// if occupied or unknown and not to traverse unknown space
return footprint_cost >= OCCUPIED; This keeps the result on |
It's not the only culprit. |
Found the impacted code: |
Howdy - some general thoughts first: Try turning on primitive interpolation (https://github.com/ros-navigation/navigation2/blob/main/nav2_smac_planner/src/smac_planner_hybrid.cpp#L109) -- though it is not available in Iron. I'm not sure if that'll help with the content of the ticket, but will definitely help with the wobbly path. It very well actually fix the problem by pushing the search more easily into more open areas, disincentivizing the expansions that yield plans near the inflated zone in the firstplace.
This is very high, I do not recommend this. This is majorly contributing to the wobbly paths you showed in the pictures. 0.005 - 0.02 is a 'reasonable' range in my opinion.
Seems low, but perfectly valid. It can be tuned for behavior w.r.t. the inflation layer, so if you're happy with the cost-repulsion of the paths, then no problem.
See previous comment on the interpolation of primitives. I'm not sure this is doing what you think it is doing. You'd be better off with a lower value probably.
We do actually use an approximated footprint cost in the heuristic computation. Its estimated since we cannot get the actual footprint in non-feasible grid expansion, but we adjust the costs and compare it to its respective constraints on inflated for circular or literal collision for non-circular: https://github.com/ros-navigation/navigation2/blob/main/nav2_smac_planner/src/node_hybrid.cpp#L674-L682. However, it does not look like we do this in Iron, so that would be a problem for your case in Iron if the collision checker is returning the footprint cost but the heuristic is using center points. I don't see Once on main, the collision checker should be returning footprint costs and the heuristic should be using adjusted footprint cost approximates, so they should be aligned. Some clarification might be good since it sounds like you ripped out one, which would make sense if you only had one and not both. But if you have both footprint considerations in the collision checker and heuristic, it should be good to go. Note though that there is some related discussion in #4314 (comment) (and my subsequent reply which is actually highly related to our conversation) that I don't recall on hand, but also relates to this same bit of code. Its on my schedule for late January to refamiliarize myself with and resolve the underlying problem, but it sounds like you're looking into this now and could be completed sooner than later. I recall and scanned through that there is some issue with the adjusted cost usage, so maybe that's what you're responding to if your Iron branch did indeed have properly implemented adjusted heuristic cost and collision checker costs.
This point is not actually strange at all. If the smoother detects that its smoothing causes a collision, it uses the last iteration's path and returns it. This works too for the case if the plan itself is in collision. This is to prevent the smoother from making a path in collision with the environment. |
No difference.
Yes, we are on a late sync "Commit 654e7e0"
No diffeence.
Our footprint can be very long, and I found the computation time very related to this parameter, it seems that the expansion explodes and the computation time can take more than 10s on a huge map with narrow corridors. But with the fix mentioned here, the computation is less impacted by this parameter.
In some really narrow and maze-like maps, the default value of 64 prevents the planner from finding a path. Pushing it to 360 makes the planner succeed and globally faster.
Yes, like in the "obstacle_critic". But it doesn't help when the footprint_cost = "inscribed" all over the corridor.
I will try
I first found the use of footprint_cost in getCost(). And then found the adjustFootprintCost(). I create this issue with these two pieces of code active. When removing one, the path is not good (3rd comment). But when removing both. The path is straight, not in the "inscribed" area, and more in the middle. So the smoother can kick in and make a perfect plan.
Yes, it is the same expansion problem. If the score is 0 everywhere or 253 everywhere, the expansion goes in every direction/orientation so the computation time explodes and the path can make strange loops or multiple turns. |
Can you check if you have that feature in your fork? I almost can't believe that 😆 It was made to handle situations like this wobble, unless there's other things not backported. I would be interested in testing on the current state of
The primitive interpolation should really help with that. Also the image you sent I think it would help with that too! If you don't have primitive interpolation, you're not actually using 360 bins. You might have 360 bins, but if your primitive moves 8 bins each left/right turn, you're really only using 360/8 of them since the others are unreachable (I'd have to calculate what actual number of bins you use with your settings, 8 is just an example). Making the number higher and higher doesn't necessarily increase resolution unless you create additional primitives that use larger turning radius' to hit more of the orientation quantizations for exploration. Anyway, probably different topics for a slack thread!
The pictures you show aren't inscribed all over the corridor though - it look to me like there's plenty of space in the middle. What I'd be interested to understand is what is the difference in distance between those 2 corridor widths, and somewhere in the middle between those 2 values, does any meaningful quantity about your robot's footprint lay? If you, for instance, made your length shorter, does it still occur? I'm wondering if there's a problem in the collision checker in the For example, when we're in open space, the footprint cost is the center cost, but when we're in confined space and we check everything, we're in the actual footprint cost. I know the heuristic just uses the approximated footprint cost (which may or may not be computed correctly from that other ticket), so when we're in open space, we're underestimating moreso than when we're in confined spaces. We could adjust here too, but that's not feeling like the right answer. The heuristic can be estimated, the traversal cost function should be more concrete. Maybe the right answer is what you said that we should just remove the optimization I made for approximate adjusted costs in the heuristic and always return center costs for the traversal cost's value. We use footprint for critical collision checking, but both the heuristic and traversal function based on center costs. That would remove the discrepancy in the cost measurements that the adjusted cost was seeking to address, just in the other way. The problem I see with that is that
Overall, you're swaying me over to your side of things. I think its just about validating that (a) the compute times don't go up, (b) the path quality stays good and (c) the change in the search behavior doesn't result in "weird" paths that get closer to obstacles in its length-wise dimension for long-non-circular robots. If those are true, I think this is a good choice. |
Bug report
The path computed by smac planner can go in "inscribed" areas and is not pushed toward middle of free space if the corridor is a bit narrow. When the corridor is a bit wider (2nd image), the path is correct:
The purple cost is lethal cost and is created using forbidden areas.
Another strange behavior is that the smoother is not applied when this bug happens. The blue line is the unsmoothed path, and the green is the smoothed one, In the first image, both paths are the same.
Required Info:
Steps to reproduce issue
Create a map with a narrow corridor and plan a path from one side to the other.
It can be reproduced with a smaller test environment and footprint:
Expected behavior
The path should respect the costmap and be more in the middle of the free space.
Actual behavior
The path doesn't respect the costmap and cut in the 'inscribed' cost.
Additional information
The planner config file
Costmap config:
The text was updated successfully, but these errors were encountered: