-
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
Signed-off-by: Tony Najjar <[email protected]>
Signed-off-by: Tony Najjar <[email protected]>
Codecov Report❌ Patch coverage is
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
@mini-1235 this seems highly related to your controller server refactor PR. |
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.
| path.poses[start_idx].pose.position.y; | ||
| float initial_translation = sqrtf(ab_x * ab_x + ab_y * ab_y); | ||
|
|
||
| if (initial_translation >= translation_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.
This should be some very small epsilon, right? 1e-3 or so? Would we really need this to be a parameter? An in-place rotation should be unambiguously in the same spot
| } | ||
|
|
||
| // Start of potential rotation sequence | ||
| float start_yaw = tf2::getYaw(path.poses[start_idx].pose.orientation); |
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.
Can't we just compare the heading if they're within 1e-3 of each other if they're different. If so, that's an in-place rotation? It really seems like this should be much simpler.
| * @param rotation_threshold Minimum total rotation to consider significant | ||
| * @return Index after the rotation sequence if found, path size if no rotation detected | ||
| */ | ||
| inline unsigned int findFirstPathRotation( |
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.
For consideration: Do we really need this to be another function? We could just have this be a possible inversion check on findFirstPathInversion with a bool for check_rotations (probably a better argument name, but you get the idea). If so, we check if there's an inplace rotation to return.
| return distance <= inversion_xy_tolerance_ && fabs(angle_distance) <= inversion_yaw_tolerance; | ||
| } | ||
|
|
||
| bool PathHandler::isWithinRotationTolerances(const geometry_msgs::msg::PoseStamped & robot_pose) |
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.
Ditto in the path handler -- could we have a cool for if we check rotations in the existing isWithinInversionTolerances as to not complicate this more? I think the in-place rotation could count as something to prune for. Maybe we re-name "inversion" with something else ("discontinuity"?) or honestly leave as-is but have an arg for whether to include the in-place rotation check
| float angle_distance = angles::shortest_angular_distance( | ||
| tf2::getYaw(robot_pose.pose.orientation), | ||
| tf2::getYaw(last_pose.pose.orientation)); | ||
| return distance <= rotation_xy_tolerance_ && fabs(angle_distance) <= rotation_yaw_tolerance_; |
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.
Would you want the in-place rotation vs inversion to be any different? If not, then that would also speak to removing duplication so the same tolerance parameters can be used either way :-) Thats what you have the defaults set to, so that's making me think that's a good idea
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 execute them. The concept is similar to how cusps are handled.
enforce_path_rotationandenforce_path_inversionaretrue, the path will be clipped to the first occurenceDescription 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-*.