Skip to content

Commit 6c0e429

Browse files
fantalukasSteveMacenski
authored andcommitted
[RPP] Add parameter to enable/disable collision detection (#3204)
* [RPP] Add parameter to enable/disable collision detection * [RPP] Update README
1 parent 46f6b19 commit 6c0e429

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

nav2_regulated_pure_pursuit_controller/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ Note: The maximum allowed time to collision is thresholded by the lookahead poin
6262
| `use_velocity_scaled_lookahead_dist` | Whether to use the velocity scaled lookahead distances or constant `lookahead_distance` |
6363
| `min_approach_linear_velocity` | The minimum velocity threshold to apply when approaching the goal |
6464
| `approach_velocity_scaling_dist` | Integrated distance from end of transformed path at which to start applying velocity scaling. This defaults to the forward extent of the costmap minus one costmap cell length. |
65-
| `max_allowed_time_to_collision_up_to_carrot` | The time to project a velocity command to check for collisions, limited to maximum distance of lookahead distance selected |
65+
| `use_collision_detection` | Whether to enable collision detection. |
66+
| `max_allowed_time_to_collision_up_to_carrot` | The time to project a velocity command to check for collisions when `use_collision_detection` is `true`. It is limited to maximum distance of lookahead distance selected. |
6667
| `use_regulated_linear_velocity_scaling` | Whether to use the regulated features for curvature |
6768
| `use_cost_regulated_linear_velocity_scaling` | Whether to use the regulated features for proximity to obstacles |
6869
| `cost_scaling_dist` | The minimum distance from an obstacle to trigger the scaling of linear velocity, if `use_cost_regulated_linear_velocity_scaling` is enabled. The value set should be smaller or equal to the `inflation_radius` set in the inflation layer of costmap, since inflation is used to compute the distance from obstacles |
@@ -112,6 +113,7 @@ controller_server:
112113
min_approach_linear_velocity: 0.05
113114
use_approach_linear_velocity_scaling: true
114115
approach_velocity_scaling_dist: 1.0
116+
use_collision_detection: true
115117
max_allowed_time_to_collision_up_to_carrot: 1.0
116118
use_regulated_linear_velocity_scaling: true
117119
use_cost_regulated_linear_velocity_scaling: false

nav2_regulated_pure_pursuit_controller/include/nav2_regulated_pure_pursuit_controller/regulated_pure_pursuit_controller.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ class RegulatedPurePursuitController : public nav2_core::Controller
292292
double approach_velocity_scaling_dist_;
293293
double control_duration_;
294294
double max_allowed_time_to_collision_up_to_carrot_;
295+
bool use_collision_detection_;
295296
bool use_regulated_linear_velocity_scaling_;
296297
bool use_cost_regulated_linear_velocity_scaling_;
297298
double cost_scaling_dist_;

nav2_regulated_pure_pursuit_controller/src/regulated_pure_pursuit_controller.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ void RegulatedPurePursuitController::configure(
8585
declare_parameter_if_not_declared(
8686
node, plugin_name_ + ".max_allowed_time_to_collision_up_to_carrot",
8787
rclcpp::ParameterValue(1.0));
88+
declare_parameter_if_not_declared(
89+
node, plugin_name_ + ".use_collision_detection",
90+
rclcpp::ParameterValue(true));
8891
declare_parameter_if_not_declared(
8992
node, plugin_name_ + ".use_regulated_linear_velocity_scaling", rclcpp::ParameterValue(true));
9093
declare_parameter_if_not_declared(
@@ -142,6 +145,9 @@ void RegulatedPurePursuitController::configure(
142145
node->get_parameter(
143146
plugin_name_ + ".max_allowed_time_to_collision_up_to_carrot",
144147
max_allowed_time_to_collision_up_to_carrot_);
148+
node->get_parameter(
149+
plugin_name_ + ".use_collision_detection",
150+
use_collision_detection_);
145151
node->get_parameter(
146152
plugin_name_ + ".use_regulated_linear_velocity_scaling",
147153
use_regulated_linear_velocity_scaling_);
@@ -346,7 +352,7 @@ geometry_msgs::msg::TwistStamped RegulatedPurePursuitController::computeVelocity
346352

347353
// Collision checking on this velocity heading
348354
const double & carrot_dist = hypot(carrot_pose.pose.position.x, carrot_pose.pose.position.y);
349-
if (isCollisionImminent(pose, linear_vel, angular_vel, carrot_dist)) {
355+
if (use_collision_detection_ && isCollisionImminent(pose, linear_vel, angular_vel, carrot_dist)) {
350356
throw nav2_core::PlannerException("RegulatedPurePursuitController detected collision ahead!");
351357
}
352358

0 commit comments

Comments
 (0)