-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix MPPI goal critic inversion (#5088) #5105
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?
Conversation
@brayanpa, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: brayanpa <brayanspallares@gmail.com>
@brayanpa, your PR has failed to build. Please check CI outputs and resolve issues. |
Signed-off-by: brayanpa <brayanspallares@gmail.com>
This pull request is in conflict. Could you fix it @brayanpa? |
Signed-off-by: Brayan Pallares <brayanspallares@gmail.com>
Signed-off-by: brayanpa <brayanspallares@gmail.com>
Signed-off-by: brayanpa <brayanspallares@gmail.com>
Signed-off-by: brayanpa <brayanspallares@gmail.com>
Signed-off-by: brayanpa <brayanspallares@gmail.com>
Signed-off-by: brayanpa <brayanspallares@gmail.com>
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.
Pedantic stuff for code coverage and readability, this is good to merge after this.
thanks so much!
For docs: Updating the docs.nav2.org configuration guide page for MPPI with what you added to the readme would be fabulous
@@ -119,6 +122,13 @@ void CostCritic::score(CriticData & data) | |||
return; | |||
} | |||
|
|||
geometry_msgs::msg::Pose active_goal; |
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.
How about just goal
(here and all other cases)?
const float goal_yaw = data.path.yaws(goal_idx); | ||
tf2::Quaternion goal_orientation_q; | ||
tf2::fromMsg(active_goal.orientation, goal_orientation_q); | ||
double goal_yaw = tf2::getYaw(goal_orientation_q); |
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 believe this works with just a geometry_msgs/Quaternion too
prev_yaw_ = tf2::getYaw(current_pose.pose.orientation); |
@@ -119,6 +122,13 @@ void CostCritic::score(CriticData & data) | |||
return; | |||
} | |||
|
|||
geometry_msgs::msg::Pose active_goal; | |||
if (enforce_path_inversion_) { |
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 we can abstract this even more to a util:
geometry_msgs::msg::Pose getCriticGoal(data, enforce_path_inversion)
{
if (enable_path_inversion) {
return getLastPathPose(data.path);
} else {
return data.goal;
}
}
that would make that function testable as a unit and we don't have all the missing coverage warnings in the individual critics for this block since we'd just call that one util in each to return the goal extracted
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.
could be a good option 👍
Basic Info
Description of testing performed
colcon testing
Description of contribution in a few bullet points
Description of how this change was tested
Tested in simulation and on a real robot across multiple maps and scenarios where feasible planners produced paths that passed near the goal before performing an inversion to reach it with the correct orientation.
Previously, the GoalCritic would interpret this proximity as having reached the goal, preventing further progress and causing the robot to get stuck.
With the new logic using the path endpoint instead of the goal pose when enforce_path_inversion is true, the robot was able to continue following the path and reach the goal correctly.
All test cases confirmed that the robot no longer gets stuck near the goal due to orientation mismatches caused by undetected path inversions.
Future work that may be required in bullet points
For Maintainers: