Skip to content

Commit 0bf689c

Browse files
zulfaqar-azmi-t4maxime-clemmkquda
authored
refactor(lane_change): add missing safety check parameter (#9928)
* refactor(lane_change): parameterize incoming object yaw threshold Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Readme Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Update planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/manager.cpp Co-authored-by: Maxime CLEMENT <78338830+maxime-clem@users.noreply.github.com> * Add missing parameters Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * missing dot Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Update planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md Co-authored-by: mkquda <168697710+mkquda@users.noreply.github.com> * update readme Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> --------- Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> Co-authored-by: Maxime CLEMENT <78338830+maxime-clem@users.noreply.github.com> Co-authored-by: mkquda <168697710+mkquda@users.noreply.github.com>
1 parent 62e07a1 commit 0bf689c

File tree

5 files changed

+49
-6
lines changed

5 files changed

+49
-6
lines changed

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,8 @@ The following parameters are used to configure terminal lane change path feature
11491149
| `collision_check.check_other_lanes` | [-] | boolean | If true, the lane change module includes objects in other lanes when performing collision assessment. | false |
11501150
| `collision_check.use_all_predicted_paths` | [-] | boolean | If false, use only the predicted path that has the maximum confidence. | true |
11511151
| `collision_check.prediction_time_resolution` | [s] | double | Time resolution for object's path interpolation and collision check. | 0.5 |
1152-
| `collision_check.yaw_diff_threshold` | [rad] | double | Maximum yaw difference between ego and object when executing rss-based collision checking | 3.1416 |
1152+
| `collision_check.yaw_diff_threshold` | [rad] | double | Maximum yaw difference between predicted ego pose and predicted object pose when executing rss-based collision checking | 3.1416 |
1153+
| `collision_check.th_incoming_object_yaw` | [rad] | double | Maximum yaw difference between current ego pose and current object pose. Objects with a yaw difference exceeding this value are excluded from the safety check. | 2.3562 |
11531154

11541155
#### safety constraints during lane change path is computed
11551156

@@ -1162,6 +1163,7 @@ The following parameters are used to configure terminal lane change path feature
11621163
| `safety_check.execution.lateral_distance_max_threshold` | [m] | double | The lateral distance threshold that is used to determine whether lateral distance between two object is enough and whether lane change is safe. | 2.0 |
11631164
| `safety_check.execution.longitudinal_distance_min_threshold` | [m] | double | The longitudinal distance threshold that is used to determine whether longitudinal distance between two object is enough and whether lane change is safe. | 3.0 |
11641165
| `safety_check.execution.longitudinal_velocity_delta_time` | [m] | double | The time multiplier that is used to compute the actual gap between vehicle at each predicted points (not RSS distance) | 0.8 |
1166+
| `safety_check.execution.extended_polygon_policy` | [-] | string | Policy used to determine the polygon shape for the safety check. Available options are: `rectangle` or `along-path`. | `rectangle` |
11651167

11661168
#### safety constraints specifically for stopped or parked vehicles
11671169

@@ -1174,6 +1176,7 @@ The following parameters are used to configure terminal lane change path feature
11741176
| `safety_check.parked.lateral_distance_max_threshold` | [m] | double | The lateral distance threshold that is used to determine whether lateral distance between two object is enough and whether lane change is safe. | 1.0 |
11751177
| `safety_check.parked.longitudinal_distance_min_threshold` | [m] | double | The longitudinal distance threshold that is used to determine whether longitudinal distance between two object is enough and whether lane change is safe. | 3.0 |
11761178
| `safety_check.parked.longitudinal_velocity_delta_time` | [m] | double | The time multiplier that is used to compute the actual gap between vehicle at each predicted points (not RSS distance) | 0.8 |
1179+
| `safety_check.parked.extended_polygon_policy` | [-] | string | Policy used to determine the polygon shape for the safety check. Available options are: `rectangle` or `along-path`. | `rectangle` |
11771180

11781181
##### safety constraints to cancel lane change path
11791182

@@ -1186,6 +1189,7 @@ The following parameters are used to configure terminal lane change path feature
11861189
| `safety_check.cancel.lateral_distance_max_threshold` | [m] | double | The lateral distance threshold that is used to determine whether lateral distance between two object is enough and whether lane change is safe. | 1.0 |
11871190
| `safety_check.cancel.longitudinal_distance_min_threshold` | [m] | double | The longitudinal distance threshold that is used to determine whether longitudinal distance between two object is enough and whether lane change is safe. | 2.5 |
11881191
| `safety_check.cancel.longitudinal_velocity_delta_time` | [m] | double | The time multiplier that is used to compute the actual gap between vehicle at each predicted points (not RSS distance) | 0.6 |
1192+
| `safety_check.cancel.extended_polygon_policy` | [-] | string | Policy used to determine the polygon shape for the safety check. Available options are: `rectangle` or `along-path`. | `rectangle` |
11891193

11901194
##### safety constraints used during lane change path is computed when ego is stuck
11911195

@@ -1198,6 +1202,7 @@ The following parameters are used to configure terminal lane change path feature
11981202
| `safety_check.stuck.lateral_distance_max_threshold` | [m] | double | The lateral distance threshold that is used to determine whether lateral distance between two object is enough and whether lane change is safe. | 2.0 |
11991203
| `safety_check.stuck.longitudinal_distance_min_threshold` | [m] | double | The longitudinal distance threshold that is used to determine whether longitudinal distance between two object is enough and whether lane change is safe. | 3.0 |
12001204
| `safety_check.stuck.longitudinal_velocity_delta_time` | [m] | double | The time multiplier that is used to compute the actual gap between vehicle at each predicted points (not RSS distance) | 0.8 |
1205+
| `safety_check.stuck.extended_polygon_policy` | [-] | string | Policy used to determine the polygon shape for the safety check. Available options are: `rectangle` or `along-path`. | `rectangle` |
12011206

12021207
(\*1) the value must be negative.
12031208

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/config/lane_change.param.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
lateral_distance_max_threshold: 2.0
5959
longitudinal_distance_min_threshold: 3.0
6060
longitudinal_velocity_delta_time: 0.0
61+
extended_polygon_policy: "rectangle"
6162
parked:
6263
expected_front_deceleration: -1.0
6364
expected_rear_deceleration: -2.0
@@ -66,6 +67,7 @@
6667
lateral_distance_max_threshold: 1.0
6768
longitudinal_distance_min_threshold: 3.0
6869
longitudinal_velocity_delta_time: 0.0
70+
extended_polygon_policy: "rectangle"
6971
cancel:
7072
expected_front_deceleration: -1.0
7173
expected_rear_deceleration: -2.0
@@ -74,6 +76,7 @@
7476
lateral_distance_max_threshold: 1.0
7577
longitudinal_distance_min_threshold: 2.5
7678
longitudinal_velocity_delta_time: 0.0
79+
extended_polygon_policy: "rectangle"
7780
stuck:
7881
expected_front_deceleration: -1.0
7982
expected_rear_deceleration: -1.0
@@ -82,6 +85,7 @@
8285
lateral_distance_max_threshold: 2.0
8386
longitudinal_distance_min_threshold: 3.0
8487
longitudinal_velocity_delta_time: 0.0
88+
extended_polygon_policy: "rectangle"
8589

8690
# lane expansion for object filtering
8791
lane_expansion:
@@ -123,7 +127,8 @@
123127
intersection: true
124128
turns: true
125129
prediction_time_resolution: 0.5
126-
yaw_diff_threshold: 3.1416
130+
th_incoming_object_yaw: 2.3562 # [rad]
131+
yaw_diff_threshold: 3.1416 # [rad]
127132
check_current_lanes: false
128133
check_other_lanes: false
129134
use_all_predicted_paths: false

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/structs/parameters.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct CollisionCheckParameters
9494
bool check_current_lane{true};
9595
bool check_other_lanes{true};
9696
bool use_all_predicted_paths{false};
97+
double th_incoming_object_yaw{2.3562};
9798
double th_yaw_diff{3.1416};
9899
double prediction_time_resolution{0.5};
99100
};

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/manager.cpp

+31-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ LCParamPtr LaneChangeModuleManager::set_params(rclcpp::Node * node, const std::s
152152
getOrDeclareParameter<double>(*node, parameter("collision_check.prediction_time_resolution"));
153153
p.safety.collision_check.th_yaw_diff =
154154
getOrDeclareParameter<double>(*node, parameter("collision_check.yaw_diff_threshold"));
155+
p.safety.collision_check.th_incoming_object_yaw =
156+
getOrDeclareParameter<double>(*node, parameter("collision_check.th_incoming_object_yaw"));
155157

156158
// rss check
157159
auto set_rss_params = [&](auto & params, const std::string & prefix) {
@@ -169,6 +171,8 @@ LCParamPtr LaneChangeModuleManager::set_params(rclcpp::Node * node, const std::s
169171
*node, parameter(prefix + ".rear_vehicle_safety_time_margin"));
170172
params.lateral_distance_max_threshold =
171173
getOrDeclareParameter<double>(*node, parameter(prefix + ".lateral_distance_max_threshold"));
174+
params.extended_polygon_policy =
175+
getOrDeclareParameter<std::string>(*node, parameter(prefix + ".extended_polygon_policy"));
172176
};
173177
set_rss_params(p.safety.rss_params, "safety_check.execution");
174178
set_rss_params(p.safety.rss_params_for_parked, "safety_check.parked");
@@ -454,6 +458,19 @@ void LaneChangeModuleManager::updateModuleParams(const std::vector<rclcpp::Param
454458
p->safety.collision_check.prediction_time_resolution);
455459
updateParam<double>(
456460
parameters, ns + "yaw_diff_threshold", p->safety.collision_check.th_yaw_diff);
461+
462+
auto th_incoming_object_yaw = p->safety.collision_check.th_incoming_object_yaw;
463+
updateParam<double>(parameters, ns + "th_incoming_object_yaw", th_incoming_object_yaw);
464+
if (th_incoming_object_yaw >= M_PI_2) {
465+
p->safety.collision_check.th_incoming_object_yaw = th_incoming_object_yaw;
466+
} else {
467+
RCLCPP_WARN_THROTTLE(
468+
node_->get_logger(), *node_->get_clock(), 5000,
469+
"The value of th_incoming_object_yaw (%.3f rad) is less than the minimum possible value "
470+
"(%.3f "
471+
"rad).",
472+
th_incoming_object_yaw, M_PI_2);
473+
}
457474
}
458475

459476
{
@@ -483,7 +500,7 @@ void LaneChangeModuleManager::updateModuleParams(const std::vector<rclcpp::Param
483500
updateParam<double>(parameters, ns + "stop_time", p->th_stop_time);
484501
}
485502

486-
auto update_rss_params = [&parameters](const std::string & prefix, auto & params) {
503+
auto update_rss_params = [&parameters, this](const std::string & prefix, auto & params) {
487504
using autoware::universe_utils::updateParam;
488505
updateParam<double>(
489506
parameters, prefix + "longitudinal_distance_min_threshold",
@@ -502,6 +519,19 @@ void LaneChangeModuleManager::updateModuleParams(const std::vector<rclcpp::Param
502519
params.rear_vehicle_safety_time_margin);
503520
updateParam<double>(
504521
parameters, prefix + "lateral_distance_max_threshold", params.lateral_distance_max_threshold);
522+
523+
auto extended_polygon_policy = params.extended_polygon_policy;
524+
updateParam<std::string>(
525+
parameters, prefix + "extended_polygon_policy", extended_polygon_policy);
526+
if (extended_polygon_policy == "rectangle" || extended_polygon_policy == "along_path") {
527+
params.extended_polygon_policy = extended_polygon_policy;
528+
} else {
529+
RCLCPP_WARN_THROTTLE(
530+
node_->get_logger(), *node_->get_clock(), 1000,
531+
"Policy %s not supported or there's typo. Make sure you choose either 'rectangle' or "
532+
"'along_path'",
533+
extended_polygon_policy.c_str());
534+
}
505535
};
506536

507537
update_rss_params("lane_change.safety_check.execution.", p->safety.rss_params);

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,9 @@ void NormalLaneChange::filterOncomingObjects(PredictedObjects & objects) const
10511051

10521052
const auto is_same_direction = [&](const PredictedObject & object) {
10531053
const auto & object_pose = object.kinematics.initial_pose_with_covariance.pose;
1054-
return !utils::path_safety_checker::isTargetObjectOncoming(current_pose, object_pose);
1054+
return !utils::path_safety_checker::isTargetObjectOncoming(
1055+
current_pose, object_pose,
1056+
common_data_ptr_->lc_param_ptr->safety.collision_check.th_incoming_object_yaw);
10551057
};
10561058

10571059
// Perception noise could make stationary objects seem opposite the ego vehicle; check the
@@ -1792,7 +1794,6 @@ bool NormalLaneChange::is_colliding(
17921794

17931795
constexpr auto is_safe{true};
17941796
auto current_debug_data = utils::path_safety_checker::createObjectDebug(obj);
1795-
constexpr auto collision_check_yaw_diff_threshold{M_PI};
17961797
constexpr auto hysteresis_factor{1.0};
17971798
const auto obj_predicted_paths = utils::path_safety_checker::getPredictedPathFromObj(
17981799
obj, lane_change_parameters_->safety.collision_check.use_all_predicted_paths);
@@ -1817,7 +1818,8 @@ bool NormalLaneChange::is_colliding(
18171818
const auto collided_polygons = utils::path_safety_checker::get_collided_polygons(
18181819
lane_change_path.path, ego_predicted_path, obj, predicted_obj_path, bpp_param.vehicle_info,
18191820
selected_rss_param, hysteresis_factor, safety_check_max_vel,
1820-
collision_check_yaw_diff_threshold, current_debug_data.second);
1821+
common_data_ptr_->lc_param_ptr->safety.collision_check.th_yaw_diff,
1822+
current_debug_data.second);
18211823

18221824
if (collided_polygons.empty()) {
18231825
utils::path_safety_checker::updateCollisionCheckDebugMap(

0 commit comments

Comments
 (0)