Skip to content

Commit 6f57e82

Browse files
authored
fix MPPI goal critic inversion (#5088) (#5105)
* fix MPPI goal critic inversion (#5088) Signed-off-by: brayanpa <[email protected]> * Support path inversion in all critics (#5088) Signed-off-by: brayanpa <[email protected]> * Fix code style issues and formatting Signed-off-by: brayanpa <[email protected]> * Remove trailing whitespaces Signed-off-by: brayanpa <[email protected]> * Fix goalAngleCritic tests Signed-off-by: brayanpa <[email protected]> * Normalize code formatting Signed-off-by: brayanpa <[email protected]> * Add getLastPathPose test Signed-off-by: brayanpa <[email protected]> * Abstract getCriticGoal in nav2_mppi critics Signed-off-by: brayanpa <[email protected]> * Fix whitespace issues Signed-off-by: brayanpa <[email protected]> * Fix getCriticGoal test Signed-off-by: brayanpa <[email protected]> --------- Signed-off-by: brayanpa <[email protected]> Signed-off-by: Brayan Pallares <[email protected]>
1 parent f95932c commit 6f57e82

22 files changed

Lines changed: 226 additions & 23 deletions

nav2_mppi_controller/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ This process is then repeated a number of times and returns a converged solution
7373
| max_robot_pose_search_dist | double | Default: Costmap half-size. Max integrated distance ahead of robot pose to search for nearest path point in case of path looping. |
7474
| prune_distance | double | Default: 1.5. Distance ahead of nearest point on path to robot to prune path to. |
7575
| transform_tolerance | double | Default: 0.1. Time tolerance for data transformations with TF. |
76-
| enforce_path_inversion | double | Default: False. If true, it will prune paths containing cusping points for segments changing directions (e.g. path inversions) such that the controller will be forced to change directions at or very near the planner's requested inversion point. This is targeting Smac Planner users with feasible paths who need their robots to switch directions where specifically requested. |
76+
| enforce_path_inversion | double | Default: False. If true, it will prune paths containing cusping points for segments changing directions (e.g. path inversions) such that the controller will be forced to change directions at or very near the planner's requested inversion point. In addition, these cusping points will also be treated by the critics as local goals that the robot will attempt to reach. This is targeting Smac Planner users with feasible paths who need their robots to switch directions where specifically requested. |
7777
| inversion_xy_tolerance | double | Default: 0.2. Cartesian proximity (m) to path inversion point to be considered "achieved" to pass on the rest of the path after path inversion. |
7878
| inversion_yaw_tolerance | double | Default: 0.4. Angular proximity (radians) to path inversion point to be considered "achieved" to pass on the rest of the path after path inversion. 0.4 rad = 23 deg. |
7979

nav2_mppi_controller/include/nav2_mppi_controller/critics/cost_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class CostCritic : public CriticFunction
144144
std::string inflation_layer_name_;
145145

146146
unsigned int power_{0};
147+
bool enforce_path_inversion_{false};
147148
};
148149

149150
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/goal_angle_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class GoalAngleCritic : public CriticFunction
4646
float threshold_to_consider_{0};
4747
unsigned int power_{0};
4848
float weight_{0};
49+
bool enforce_path_inversion_{false};
4950
};
5051

5152
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/goal_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class GoalCritic : public CriticFunction
4646
unsigned int power_{0};
4747
float weight_{0};
4848
float threshold_to_consider_{0};
49+
bool enforce_path_inversion_{false};
4950
};
5051

5152
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/obstacles_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class ObstaclesCritic : public CriticFunction
9797

9898
unsigned int power_{0};
9999
float repulsion_weight_, critical_weight_{0};
100+
bool enforce_path_inversion_{false};
100101
std::string inflation_layer_name_;
101102
};
102103

nav2_mppi_controller/include/nav2_mppi_controller/critics/path_align_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class PathAlignCritic : public CriticFunction
5252
bool use_path_orientations_{false};
5353
unsigned int power_{0};
5454
float weight_{0};
55+
bool enforce_path_inversion_{false};
5556
};
5657

5758
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/path_angle_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class PathAngleCritic : public CriticFunction
8181

8282
unsigned int power_{0};
8383
float weight_{0};
84+
bool enforce_path_inversion_{false};
8485
};
8586

8687
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/path_follow_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class PathFollowCritic : public CriticFunction
5353

5454
unsigned int power_{0};
5555
float weight_{0};
56+
bool enforce_path_inversion_{false};
5657
};
5758

5859
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/prefer_forward_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class PreferForwardCritic : public CriticFunction
4545
unsigned int power_{0};
4646
float weight_{0};
4747
float threshold_to_consider_{0};
48+
bool enforce_path_inversion_{false};
4849
};
4950

5051
} // namespace mppi::critics

nav2_mppi_controller/include/nav2_mppi_controller/critics/twirling_critic.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class TwirlingCritic : public CriticFunction
4444
protected:
4545
unsigned int power_{0};
4646
float weight_{0};
47+
bool enforce_path_inversion_{false};
4748
};
4849

4950
} // namespace mppi::critics

0 commit comments

Comments
 (0)