Removed squaring from constrained smoother cost function shape#6000
Removed squaring from constrained smoother cost function shape#6000videh25 wants to merge 5 commits intoros-navigation:mainfrom
Conversation
Signed-off-by: videh25 <videhpatel25@gmail.com>
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
nav2_constrained_smoother/README.md
Outdated
| 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 :-)
nav2_constrained_smoother/include/nav2_constrained_smoother/smoother_cost_function.hpp
Show resolved
Hide resolved
| } | ||
|
|
||
| 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 :-)
mini-1235
left a comment
There was a problem hiding this comment.
Also tests are failing after the changes: https://app.circleci.com/pipelines/github/ros-navigation/navigation2/18155/workflows/b2ce8ae9-f4b4-4915-927a-e6f465eb63d3/jobs/54622/tests
Signed-off-by: videh25 <videhpatel25@gmail.com>
Signed-off-by: videh25 <videhpatel25@gmail.com>
Signed-off-by: videh25 <videhpatel25@gmail.com>
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 |
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-*.