-
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. |
@@ -21,6 +21,9 @@ namespace mppi::critics | |||
|
|||
void GoalCritic::initialize() | |||
{ | |||
auto getParentParam = parameters_handler_->getParamGetter(parent_name_); | |||
getParentParam(enforce_path_inversion_, "enforce_path_inversion", false); |
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 should be using the name_
getter instead. This is a goal critic plugin specific parameterization
@@ -40,8 +43,14 @@ void GoalCritic::score(CriticData & data) | |||
return; | |||
} | |||
|
|||
const auto & goal_x = data.goal.position.x; | |||
const auto & goal_y = data.goal.position.y; | |||
auto goal_x = data.goal.position.x; |
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.
Should withinPositionGoalTolerance
use the back of the path as well in this case @BriceRenaudeau? Possibly need to be considered for other critic plugins as well
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 it would be good to add it to the goal_angle_critic
. Let me know if you think it should be added to any others as well.
Regarding adding it to withinPositionGoalTolerance
, I think the best approach would be to create a parameter in each critic plugin to choose whether to use the existing withinPositionGoalTolerance
logic or a new one that considers path inversions. What do you think?
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.
@brayanpa I think you're probably right that we should have enforce_path_inversion
be a plugin-level parameter that is used in the individual plugins as-needed.
I think Goal and GoalAngle are obvious ones that need to look at that and use the goal vs local goal for both is computation, but also its within tolerance check.
The others are Cost, Obstacles, Twirl, Path Align, Path Follow, Path Angle, and Prefer Forward.
The Path Align/Follow/Angle have natural hand-offs from the Goal and GoalAngle critics, so anything that the Path critics sees the Goal critics also need to see. If intermediary goals for path inversions are near obstacles like the goal, I think the Cost and Obstacles critics probably should have it too. At that point, lets just make it universal for consistency.
So, I think the first thing we should do in each critics' score
method is to check on the inversion parameter and store the data.goal
or data.path(-1)
for the goal to check. Then that should be used for withinPositionGoalTolerance
and for the computation of the critic value where necessary.
A small change to the README and parameter guide should be made to make it clear this is used by both the path handler for enforcing path inversions and the critics' behaviors that these are treated as local goals to achieve.
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 have added the enforce_path_inversion
parameter to all critics and modified the goal between the end of the path and the original goal accordingly in the necessary critics. In the tests I performed, it is working very well. The robot is able to handle path inversion correctly, and when enforce_path_inversion
is set to false, it behaves just like before.
I'll be on the lookout in case any further changes are needed, or if you think any additional clarification is required in the README or documentation.
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>
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: