Skip to content

Conversation

@tonynajjar
Copy link
Contributor

@tonynajjar tonynajjar commented Oct 23, 2025


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1)
Primary OS tested on (Ubuntu, MacOS, Windows)
Robotic platform tested on (Steve's Robot, gazebo simulation of Tally, hardware turtlebot)
Does this PR contain AI generated software? (No; Yes and it is marked inline in the code)
Was this PR description generated by AI software? Out of respect for maintainers, AI for human-to-human communications are banned

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.

  • I added the detection of in-place rotations and the optional pruning of the path up until that point
  • if both enforce_path_rotation and enforce_path_inversion are true, the path will be clipped to the first occurence

Description of documentation updates required from your changes

  • Added new parameter, so need to add that to default configs and documentation page

Description of how this change was tested

  • Need to write/adapt tests

Future work that may be required in bullet points

For Maintainers:

  • Check that any new parameters added are updated in docs.nav2.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists
  • Should this be backported to current distributions? If so, tag with backport-*.

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 10.41667% with 43 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...oller/include/nav2_mppi_controller/tools/utils.hpp 0.00% 27 Missing ⚠️
nav2_mppi_controller/src/path_handler.cpp 23.80% 16 Missing ⚠️
Files with missing lines Coverage Δ
...nclude/nav2_mppi_controller/tools/path_handler.hpp 100.00% <ø> (ø)
nav2_mppi_controller/src/path_handler.cpp 70.45% <23.80%> (-13.37%) ⬇️
...oller/include/nav2_mppi_controller/tools/utils.hpp 86.93% <0.00%> (-10.77%) ⬇️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SteveMacenski
Copy link
Member

@mini-1235 this seems highly related to your controller server refactor PR.

Copy link
Member

@SteveMacenski SteveMacenski left a 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) {
Copy link
Member

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);
Copy link
Member

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(
Copy link
Member

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)
Copy link
Member

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_;
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants