-
Notifications
You must be signed in to change notification settings - Fork 1.6k
MPPI: Clip path up to in-place rotation #5648
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
base: main
Are you sure you want to change the base?
MPPI: Clip path up to in-place rotation #5648
Conversation
Codecov Report❌ Patch coverage is
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@mini-1235 this seems highly related to your controller server refactor PR. |
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.
I think this can be simplified in both the main util function implementation & the integration by having the rotational checks be inserted in the inversion checks / tolerance validation methods as an optional setting to check for in-place rotations.
nav2_mppi_controller/include/nav2_mppi_controller/tools/utils.hpp
Outdated
Show resolved
Hide resolved
nav2_mppi_controller/include/nav2_mppi_controller/tools/utils.hpp
Outdated
Show resolved
Hide resolved
nav2_mppi_controller/include/nav2_mppi_controller/tools/utils.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Tony Najjar <[email protected]>
2a1060f to
4d72845
Compare
Signed-off-by: Tony Najjar <[email protected]>
Sorry I just saw this Hi @tonynajjar, in #5446 I actually added in-place roation check in navigation2/nav2_util/include/nav2_util/path_utils.hpp Lines 107 to 119 in c669b68
Could you take a look and see if that also works for your case? |
@mini-1235 thanks for the heads-up. I won't be able to try out the whole PR but I took a look and there are some differences in functionality:
|
|
Thanks @tonynajjar, that makes sense! Will update in the PR accordingly |
|
@mini-1235 should your SimplePathHandler PR have this updated to respect? |
| } | ||
|
|
||
| if (enforce_path_rotation_) { | ||
| getParam(minimum_rotation_angle_, "minimum_rotation_angle", 0.785); |
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.
Is 45 deg sensible for this limit by default?
Also parameter guide updates required for this param addition (among others)
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.
Also for simplicity, I think this can go into the if (enforce_path_inversion_ || enforce_path_rotation_) conditional. If !enforce_path_rotation_ then it won't be used anyway.
| float rotation_check = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | ||
| inversion_locale_ = utils::removePosesAfterFirstInversion( | ||
| global_plan_up_to_inversion_, rotation_check); |
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.
| float rotation_check = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | |
| inversion_locale_ = utils::removePosesAfterFirstInversion( | |
| global_plan_up_to_inversion_, rotation_check); | |
| float rotation_threshold = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | |
| inversion_locale_ = utils::removePosesAfterFirstInversion( | |
| global_plan_up_to_inversion_, rotation_threshold); |
I think the check implies its a boolean when its really a threshold
| float rotation_check = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | ||
| inversion_locale_ = utils::removePosesAfterFirstInversion( | ||
| global_plan_up_to_inversion_, rotation_check); |
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.
| float rotation_check = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | |
| inversion_locale_ = utils::removePosesAfterFirstInversion( | |
| global_plan_up_to_inversion_, rotation_check); | |
| float rotation_threshold = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | |
| inversion_locale_ = utils::removePosesAfterFirstInversion( | |
| global_plan_up_to_inversion_, rotation_threshold); |
|
|
||
| // Find and restrict to the first rotation or inversion constraint | ||
| float rotation_check = enforce_path_rotation_ ? minimum_rotation_angle_ : 0.0f; | ||
| inversion_locale_ = utils::removePosesAfterFirstInversion( |
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.
Isn't this missing the if for if we are even using path inversions (+ your new rotations)?
| if (first_after_inversion == path.poses.size()) { | ||
| return 0u; | ||
|
|
||
| const unsigned int first_constraint = findFirstPathInversion(cropped_path, rotation_threshold); |
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.
Rename to first_after_constraint
| float dot_product = (oa_x * ab_x) + (oa_y * ab_y); | ||
| if (dot_product < 0.0f) { | ||
| return idx + 1; | ||
| unsigned int first_constraint = path.poses.size(); |
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.
first_after_constraint as well
| * @return the first point after the inversion or rotation found in the path | ||
| */ | ||
| inline unsigned int findFirstPathInversion(nav_msgs::msg::Path & path) | ||
| inline unsigned int findFirstPathInversion( |
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.
Not a required change, but I think this would be more compact (efficient, sure, though mostly for compactness) if we could combine this into a single loop. There's much duplication and really the only difference is that the minimum length is 3 rather than 4 (which could be hand waved away perhaps?)
|
Pretty small peanuts, should be able to merge after the next set of changes. @mini-1235 please review yourself :-) |
Yes, I forgot to push that update upstream
Will review tomorrow / Friday |
Basic Info
Description of contribution in a few bullet points
With SMACLattice I now have in-place rotations in my path and want to force MPPI to prune up until these rotations. The concept is similar to how cusps are handled.
enforce_path_rotationandenforce_path_inversionaretrue, the path will be clipped to the first occurrenceDescription of documentation updates required from your changes
Description of how this change was tested
Future work that may be required in bullet points
For Maintainers:
backport-*.