Removed squaring from constrained smoother cost function shape#6000
Conversation
Signed-off-by: videh25 <[email protected]>
3ebf1c1 to
dafa77d
Compare
SteveMacenski
left a comment
There was a problem hiding this comment.
A couple of questions and a request for doc updates! LGTM
| w_smooth: 2000000.0 # weight to maximize smoothness of path | ||
| w_cost: 0.015 # weight to steer robot away from collision and cost | ||
| w_smooth: 5.0e5 # weight to maximize smoothness of path | ||
| w_cost: 0.12 # weight to steer robot away from collision and cost |
There was a problem hiding this comment.
Please add to the migration guide at docs.nav2.org that this improvement has been had which increases path quality + convergence time. Also update the parameter defaults to be more in line with what folks should use in the configuration guide for the constrained smoother :-)
| } | ||
|
|
||
| r += (T)weight * ki_minus_kmax * ki_minus_kmax; // objective function value | ||
| r += (T)std::sqrt(weight) * ki_minus_kmax; // objective function value |
There was a problem hiding this comment.
If we're changing the formulation for the defaults to need adjustment, could the defaults themselves just account on being squared so we don't perform these sqrt operations over the weights? I.e. retune the defaults to be sqrt of it's updated value? That would remove some relatively heavy operations
The cost check points may also be the same?
There was a problem hiding this comment.
I too agree with removing the repeated square root functions.
Just listing down ways and concerns in doing so:
- Square root the weights in configuration and remove
sqrtfrom the code.- For anyone considering the mathematical formulation of cost function, it is natural to think of the weights mentioned in the config to be the ones directly being multiplied to individual squared costs, since that is how the formulae are generally mentioned in papers and academia.
- Weights being squared internally by
cereswill be misleading. - This can work if we also update the documentation to explicitly mention the mathematical formulation used in the smoother to mention that the
yamlweights are squared by ceres.
- Keep the
yamlvalues andsqrtthem when the parameter is fetched/updated- Values mentioned in the config will be the same as the ones multiplied to the squared cost terms, despite of
ceressquaring them internally. - Might have to rename the class variables to something like
weight_sqrtedsince they are not the exact same values as inyaml?
- Values mentioned in the config will be the same as the ones multiplied to the squared cost terms, despite of
Please let me know what approach sounds best!
There was a problem hiding this comment.
I think the second option probably makes the most sense
There was a problem hiding this comment.
I agree with the second one :-)
Signed-off-by: videh25 <[email protected]>
Signed-off-by: videh25 <[email protected]>
Signed-off-by: videh25 <[email protected]>
There was a problem hiding this comment.
LGTM!
Only 3 asks:
- There are a number of tests that fail now, can you take a look and address? This includes DCO (which is easy if you click on the job it tells you what to run)
- Can you update the migration guide in docs.nav2.org to mention this fix + updated parameters required?
- Does it make sense to update the defaults in the code / example yaml in the configuration guide for the constrained smoother as well to be what you've found works well now?
|
|
I would suggest keeping the |
|
Agreed with @mini-1235 |
…vable: 483, 1044 (Could not nudge the smoothness improvement by increasing w_smooth Signed-off-by: videh25 <[email protected]>
Signed-off-by: videh25 <[email protected]>
e0f8695 to
b833e20
Compare
|
Let me know when you want me to review again :-) |
Signed-off-by: videh25 <[email protected]>
Signed-off-by: videh25 <[email protected]>
|
Hey @SteveMacenski @mini-1235! I am almost done with tuning the tests. Just want to run some specific cases through you guys. Here is a google drive folder containing the visuals of how each smoother call in tests improved the path previously vs now. During retuning the parameters, I tried to ensure that the qualitative nature of improvements remain the same for each smoother call. However, here are a few notable deviations:
|
Yes, this is a different formulation so I would expect some variation. They both look good though 👍
Does this test not try to maintain the start/goal orientations? If so, then this makes sense. Technically a straight line is the lowest-curvature option as long as the boundary conditions aren't being respected to force a curve.
A number of these look rather odd, having pretty extreme moves (like #4) that don't seem justified / well traded off for smoothness / length. But I suppose the originals also look a little extreme. Can we tone that down a bit? The behavior in #2 looks pretty reasonable. |
… some tests Signed-off-by: videh25 <[email protected]>
Signed-off-by: videh25 <[email protected]>
No, that test is specifically for the case where start and goal locations are not maintained.
I have tuned the parameters in However, a test is failing now. Here is the context for that:
Also, |
Looks great to me! For the tests: I'd say delete any that don't pass your sniff test and create some new ones that are better / less fragile. The cusp movement feature was added after the fact and may have been too prescriptive based on the behavior at the time rather than good general-purpose tests (it appears) |
Signed-off-by: videh25 <[email protected]>
|
Here is a summary of changes made in tests in
|
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 9 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Opened a corresponding PR in |
…avigation#6000) * Removed squaring from constrained smoother cost function shape Signed-off-by: videh25 <[email protected]> * Moved sqrt to param loading Signed-off-by: videh25 <[email protected]> * Retuned parameters Signed-off-by: videh25 <[email protected]> * Updated the retuned parameters in tests Signed-off-by: videh25 <[email protected]> * Paritally fixed test- fixed all solvable performance decreases. Unsolvable: 483, 1044 (Could not nudge the smoothness improvement by increasing w_smooth Signed-off-by: videh25 <[email protected]> * Tuned ObstacleAvoidanceNearCusps to only have slight improvements Signed-off-by: videh25 <[email protected]> * Tuned ObstacleAvoidanceNearCusps to only have slight improvements Signed-off-by: videh25 <[email protected]> * Nudged improvement tests to expect better improvements Signed-off-by: videh25 <[email protected]> * Tuned ObstacleAvoidanceNearCusps to only have smoother paths -failing some tests Signed-off-by: videh25 <[email protected]> * Updated README Signed-off-by: videh25 <[email protected]> * Modified testingObstacleAvoidanceNearCusps tests to be less fragile Signed-off-by: videh25 <[email protected]> --------- Signed-off-by: videh25 <[email protected]>


Basic Info
Description of contribution in a few bullet points
nav2_constrained_smoother.nav2_constraind_smoother.Description of documentation updates required from your changes
nav2_constrained_smoother's configure guide will have to be updated with the new parameters.Description of how this change was tested
Future work that may be required in bullet points
NA
For Maintainers:
backport-*.