Skip to content

Commit fd54b24

Browse files
authored
feat(out_of_lane): add objects.extra_width parameter (#10923)
Signed-off-by: Maxime CLEMENT <[email protected]>
1 parent f45d5f9 commit fd54b24

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ In the debug visualization, the filtered predicted paths are shown in green and
6363
### 5. Time to collisions
6464

6565
For each out of lane area, we calculate the times when a dynamic object will overlap the area based on its filtered predicted paths.
66+
To make it more likely to detect collision in the other lanes, the width of the dynamic object can be increased using the parameter `objects.extra_width`.
6667

6768
In the case where parameter `mode` is set to `threshold` and the calculated time is less than `threshold.time_threshold` parameter, then we decide to avoid the out of lane area.
6869

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/config/out_of_lane.param.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
cut_predicted_paths_beyond_red_lights: true # if true, predicted paths are cut beyond the stop line of red traffic lights
1818
ignore_behind_ego: false # if true, objects behind the ego vehicle are ignored
1919
validate_predicted_paths_on_lanelets: true # if true, an out of lane collision is only considered if the predicted path fully follows a sequence of lanelets that include the out of lane lanelet
20+
extra_width: 1.0 # [m] extra width around detected objects, making it more likely to detect an out of lane collision
2021

2122
action: # action to insert in the trajectory if an object causes a conflict at an overlap
2223
use_map_stop_lines: true # if true, try to stop at stop lines defined in the vector map

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/src/out_of_lane_collisions.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,15 @@ void calculate_object_path_time_collisions(
219219
void calculate_objects_time_collisions(
220220
OutOfLaneData & out_of_lane_data,
221221
const std::vector<autoware_perception_msgs::msg::PredictedObject> & objects,
222-
const route_handler::RouteHandler & route_handler,
223-
const bool validate_predicted_paths_on_lanelets)
222+
const route_handler::RouteHandler & route_handler, const PlannerParam & params)
224223
{
225224
for (const auto & object : objects) {
225+
auto shape = object.shape;
226+
shape.dimensions.y += params.objects_extra_width * 0.5;
226227
for (const auto & path : object.kinematics.predicted_paths) {
227228
calculate_object_path_time_collisions(
228-
out_of_lane_data, path, object.shape, route_handler, validate_predicted_paths_on_lanelets);
229+
out_of_lane_data, path, object.shape, route_handler,
230+
params.validate_predicted_paths_on_lanelets);
229231
}
230232
}
231233
}

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/src/out_of_lane_collisions.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ void calculate_object_path_time_collisions(
4040
void calculate_objects_time_collisions(
4141
OutOfLaneData & out_of_lane_data,
4242
const std::vector<autoware_perception_msgs::msg::PredictedObject> & objects,
43-
const route_handler::RouteHandler & route_handler,
44-
const bool validate_predicted_paths_on_lanelets);
43+
const route_handler::RouteHandler & route_handler, const PlannerParam & params);
4544

4645
/// @brief calculate the collisions to avoid
4746
/// @details either uses the time to collision or just the time when the object will arrive at the

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/src/out_of_lane_module.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void OutOfLaneModule::init_parameters(rclcpp::Node & node)
9999
get_or_declare_parameter<bool>(node, ns_ + ".objects.ignore_behind_ego");
100100
pp.validate_predicted_paths_on_lanelets =
101101
get_or_declare_parameter<bool>(node, ns_ + ".objects.validate_predicted_paths_on_lanelets");
102+
pp.objects_extra_width = get_or_declare_parameter<double>(node, ns_ + ".objects.extra_width");
102103

103104
pp.precision = get_or_declare_parameter<double>(node, ns_ + ".action.precision");
104105
pp.use_map_stop_lines = get_or_declare_parameter<bool>(node, ns_ + ".action.use_map_stop_lines");
@@ -147,6 +148,7 @@ void OutOfLaneModule::update_parameters(const std::vector<rclcpp::Parameter> & p
147148
update_param(
148149
parameters, ns_ + ".objects.validate_predicted_paths_on_lanelets",
149150
pp.validate_predicted_paths_on_lanelets);
151+
update_param(parameters, ns_ + ".objects.extra_width", pp.objects_extra_width);
150152

151153
update_param(parameters, ns_ + ".action.precision", pp.precision);
152154
update_param(parameters, ns_ + ".action.use_map_stop_lines", pp.use_map_stop_lines);
@@ -398,12 +400,11 @@ VelocityPlanningResult OutOfLaneModule::plan(
398400

399401
stopwatch.tic("calculate_time_collisions");
400402
out_of_lane::calculate_objects_time_collisions(
401-
out_of_lane_data, objects.objects, *planner_data->route_handler,
402-
params_.validate_predicted_paths_on_lanelets);
403+
out_of_lane_data, objects.objects, *planner_data->route_handler, params_);
403404
const auto calculate_time_collisions_us = stopwatch.toc("calculate_time_collisions");
404405

405406
stopwatch.tic("calculate_times");
406-
const auto is_stopping = previous_slowdown_pose_ ? true : false;
407+
const auto is_stopping = previous_slowdown_pose_.has_value();
407408
out_of_lane::calculate_collisions_to_avoid(
408409
out_of_lane_data, ego_data.trajectory_points, params_, is_stopping);
409410
const auto calculate_times_us = stopwatch.toc("calculate_times");

planning/motion_velocity_planner/autoware_motion_velocity_out_of_lane_module/src/types.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct PlannerParam
6262
validate_predicted_paths_on_lanelets; // if true, an out of lane collision is only considered
6363
// if the predicted path fully follows a sequence of
6464
// lanelets that include the out of lane lanelet
65+
double objects_extra_width; // [m] extra width to apply to the object footprints
6566

6667
// action to insert in the trajectory if an object causes a collision at an overlap
6768
double lon_dist_buffer; // [m] safety distance buffer to keep in front of the ego vehicle
@@ -148,7 +149,7 @@ struct SlowdownPose
148149

149150
SlowdownPose() = default;
150151
SlowdownPose(
151-
const double arc_length, const rclcpp::Time start_time, const geometry_msgs::msg::Pose & pose,
152+
const double arc_length, const rclcpp::Time & start_time, const geometry_msgs::msg::Pose & pose,
152153
const bool is_active)
153154
: arc_length(arc_length), start_time(start_time), pose(pose), is_active(is_active)
154155
{

0 commit comments

Comments
 (0)