Skip to content

Commit 4251c65

Browse files
authoredFeb 12, 2025
feat(lane_change): revise current lane objects filtering (autowarefoundation#9785) (#1769)
* consider stopped front objects * simplify computation of dist to front current lane object * add flag to enable/disable keeping distance from front stopped vehicle * fix object filtering test --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Signed-off-by: Kyoichi Sugahara <kyoichi.sugahara@tier4.jp>
1 parent 8a6c325 commit 4251c65

File tree

7 files changed

+43
-20
lines changed

7 files changed

+43
-20
lines changed
 

‎planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ The following parameters are configurable in [lane_change.param.yaml](https://gi
886886
| `backward_length_buffer_for_end_of_lane` | [m] | double | The end of lane buffer to ensure ego vehicle has enough distance to start lane change | 3.0 |
887887
| `backward_length_buffer_for_blocking_object` | [m] | double | The end of lane buffer to ensure ego vehicle has enough distance to start lane change when there is an object in front | 3.0 |
888888
| `backward_length_from_intersection` | [m] | double | Distance threshold from the last intersection to invalidate or cancel the lane change path | 5.0 |
889+
| `enable_stopped_vehicle_buffer` | [-] | bool | If true, will keep enough distance from current lane front stopped object to perform lane change when possible | true |
889890
| `trajectory.max_prepare_duration` | [s] | double | The maximum preparation time for the ego vehicle to be ready to perform lane change. | 4.0 |
890891
| `trajectory.min_prepare_duration` | [s] | double | The minimum preparation time for the ego vehicle to be ready to perform lane change. | 2.0 |
891892
| `trajectory.lateral_jerk` | [m/s3] | double | Lateral jerk value for lane change path generation | 0.5 |

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

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
backward_length_buffer_for_end_of_lane: 3.0 # [m]
66
backward_length_buffer_for_blocking_object: 3.0 # [m]
77
backward_length_from_intersection: 5.0 # [m]
8+
enable_stopped_vehicle_buffer: true
89

910
# turn signal
1011
min_length_for_turn_signal_activation: 10.0 # [m]

‎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
@@ -149,6 +149,7 @@ struct Parameters
149149
double backward_length_buffer_for_end_of_lane{0.0};
150150
double backward_length_buffer_for_blocking_object{0.0};
151151
double backward_length_from_intersection{5.0};
152+
bool enable_stopped_vehicle_buffer{false};
152153

153154
// parked vehicle
154155
double object_check_min_road_shoulder_width{0.5};

‎planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/manager.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ LCParamPtr LaneChangeModuleManager::set_params(rclcpp::Node * node, const std::s
194194
getOrDeclareParameter<double>(*node, parameter("backward_length_buffer_for_blocking_object"));
195195
p.backward_length_from_intersection =
196196
getOrDeclareParameter<double>(*node, parameter("backward_length_from_intersection"));
197+
p.enable_stopped_vehicle_buffer =
198+
getOrDeclareParameter<bool>(*node, parameter("enable_stopped_vehicle_buffer"));
197199

198200
if (p.backward_length_buffer_for_end_of_lane < 1.0) {
199201
RCLCPP_WARN_STREAM(
@@ -304,6 +306,8 @@ void LaneChangeModuleManager::updateModuleParams(const std::vector<rclcpp::Param
304306
p->backward_length_buffer_for_blocking_object);
305307
updateParam<double>(
306308
parameters, ns + "lane_change_finish_judge_buffer", p->lane_change_finish_judge_buffer);
309+
updateParam<bool>(
310+
parameters, ns + "enable_stopped_vehicle_buffer", p->enable_stopped_vehicle_buffer);
307311

308312
updateParam<double>(
309313
parameters, ns + "finish_judge_lateral_threshold", p->th_finish_judge_lateral_diff);

‎planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ void NormalLaneChange::insert_stop_point_on_current_lanes(PathWithLaneId & path)
552552

553553
const auto dist_to_terminal_stop = std::min(dist_to_terminal_start, distance_to_last_fit_width);
554554

555-
if (filtered_objects_.current_lane.empty()) {
555+
if (
556+
filtered_objects_.current_lane.empty() ||
557+
!lane_change_parameters_->enable_stopped_vehicle_buffer) {
556558
set_stop_pose(dist_to_terminal_stop, path);
557559
return;
558560
}
@@ -1022,8 +1024,6 @@ FilteredLanesObjects NormalLaneChange::filter_objects() const
10221024
filtered_objects.target_lane_trailing.reserve(reserve_size);
10231025
filtered_objects.others.reserve(reserve_size);
10241026

1025-
const auto stopped_obj_vel_th = lane_change_parameters_->safety.th_stopped_object_velocity;
1026-
10271027
for (const auto & object : objects.objects) {
10281028
auto ext_object = utils::lane_change::transform(object, *lane_change_parameters_);
10291029
const auto & ext_obj_pose = ext_object.initial_pose;
@@ -1042,12 +1042,8 @@ FilteredLanesObjects NormalLaneChange::filter_objects() const
10421042
continue;
10431043
}
10441044

1045-
// TODO(Azu): We have to think about how to remove is_within_vel_th without breaking AW behavior
1046-
const auto is_moving = velocity_filter(
1047-
ext_object.initial_twist, stopped_obj_vel_th, std::numeric_limits<double>::max());
1048-
10491045
if (
1050-
ahead_of_ego && is_moving && is_before_terminal &&
1046+
ahead_of_ego && is_before_terminal &&
10511047
!boost::geometry::disjoint(ext_object.initial_polygon, lanes_polygon.current)) {
10521048
// check only the objects that are in front of the ego vehicle
10531049
filtered_objects.current_lane.push_back(ext_object);

‎planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/utils.cpp

+10-12
Original file line numberDiff line numberDiff line change
@@ -1101,19 +1101,17 @@ double get_min_dist_to_current_lanes_obj(
11011101
continue;
11021102
}
11031103

1104-
// calculate distance from path front to the stationary object polygon on the ego lane.
1105-
for (const auto & polygon_p : object.initial_polygon.outer()) {
1106-
const auto p_fp = autoware::universe_utils::toMsg(polygon_p.to_3d());
1107-
const auto lateral_fp = motion_utils::calcLateralOffset(path_points, p_fp);
1108-
1109-
// ignore if the point is not on ego path
1110-
if (std::abs(lateral_fp) > (common_data_ptr->bpp_param_ptr->vehicle_width / 2)) {
1111-
continue;
1112-
}
1113-
1114-
const auto current_distance_to_obj = motion_utils::calcSignedArcLength(path_points, 0, p_fp);
1115-
min_dist_to_obj = std::min(min_dist_to_obj, current_distance_to_obj);
1104+
// check if object is on ego path
1105+
const auto obj_half_width = object.shape.dimensions.y / 2;
1106+
const auto obj_lat_dist_to_path =
1107+
std::abs(motion_utils::calcLateralOffset(path_points, object.initial_pose.position)) -
1108+
obj_half_width;
1109+
if (obj_lat_dist_to_path > (common_data_ptr->bpp_param_ptr->vehicle_width / 2)) {
1110+
continue;
11161111
}
1112+
1113+
min_dist_to_obj = std::min(min_dist_to_obj, dist_to_obj);
1114+
break;
11171115
}
11181116
return min_dist_to_obj;
11191117
}

‎planning/behavior_path_planner/autoware_behavior_path_lane_change_module/test/test_lane_change_scene.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,28 @@ TEST_F(TestNormalLaneChange, testGetPathWhenInvalid)
209209
ASSERT_FALSE(lc_status.is_valid_path);
210210
}
211211

212+
TEST_F(TestNormalLaneChange, testFilteredObjects)
213+
{
214+
constexpr auto is_approved = true;
215+
ego_pose_ = autoware::test_utils::createPose(1.0, 1.75, 0.0, 0.0, 0.0, 0.0);
216+
planner_data_->self_odometry = set_odometry(ego_pose_);
217+
set_previous_approved_path();
218+
219+
normal_lane_change_->update_lanes(!is_approved);
220+
normal_lane_change_->update_filtered_objects();
221+
222+
const auto & filtered_objects = get_filtered_objects();
223+
224+
const auto filtered_size =
225+
filtered_objects.current_lane.size() + filtered_objects.target_lane_leading.size() +
226+
filtered_objects.target_lane_trailing.size() + filtered_objects.others.size();
227+
EXPECT_EQ(filtered_size, planner_data_->dynamic_object->objects.size());
228+
EXPECT_EQ(filtered_objects.current_lane.size(), 1);
229+
EXPECT_EQ(filtered_objects.target_lane_leading.size(), 2);
230+
EXPECT_EQ(filtered_objects.target_lane_trailing.size(), 0);
231+
EXPECT_EQ(filtered_objects.others.size(), 1);
232+
}
233+
212234
TEST_F(TestNormalLaneChange, testGetPathWhenValid)
213235
{
214236
constexpr auto is_approved = true;

0 commit comments

Comments
 (0)
Failed to load comments.