Skip to content

Commit dbcf7aa

Browse files
fix(lane_change): insert stop for current lanes object (RT0-33761) (#9070)
* RT0-33761 fix lc insert stop for current lanes object Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * fix wrong value used for comparison Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * ignore current lane object that is not on ego's path Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * remove print Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * update readme Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Update planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/utils/utils.cpp Co-authored-by: mkquda <168697710+mkquda@users.noreply.github.com> * revert is_within_vel_th removal Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * fix flowchart too wide Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * rename variable in has_blocking_target_object_for_stopping Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * Add docstring and rename function Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> * change color Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> --------- Signed-off-by: Zulfaqar Azmi <zulfaqar.azmi@tier4.jp> Co-authored-by: mkquda <168697710+mkquda@users.noreply.github.com>
1 parent d01ae0d commit dbcf7aa

File tree

7 files changed

+286
-127
lines changed

7 files changed

+286
-127
lines changed

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md

+81-10
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ if (max_lane_change_length > ego's distance to the end of the current lanes.) t
195195
stop
196196
endif
197197
198-
if ego is stuck in the current lanes then (yes)
198+
if (ego is stuck in the current lanes) then (yes)
199199
:Return **sampled acceleration values**;
200200
stop
201201
else (no)
@@ -540,35 +540,106 @@ The following figure illustrates when the lane is blocked in multiple lane chang
540540

541541
![multiple-lane-changes](./images/lane_change-when_cannot_change_lanes.png)
542542

543-
#### Stopping position when an object exists ahead
543+
### Stopping behavior
544544

545-
When an obstacle is in front of the ego vehicle, stop with keeping a distance for lane change.
546-
The position to be stopped depends on the situation, such as when the lane change is blocked by the target lane obstacle, or when the lane change is not needed immediately.The following shows the division in that case.
545+
The stopping behavior of the ego vehicle is determined based on various factors, such as the number of lane changes required, the presence of obstacles, and the position of blocking objects in relation to the lane change plan. The objective is to choose a suitable stopping point that allows for a safe and effective lane change while adapting to different traffic scenarios.
547546

548-
##### When the ego vehicle is near the end of the lane change
547+
The following flowchart and subsections explain the conditions for deciding where to insert a stop point when an obstacle is ahead.
549548

550-
Regardless of the presence or absence of objects in the lane change target lane, stop by keeping the distance necessary for lane change to the object ahead.
549+
```plantuml
550+
@startuml
551+
skinparam defaultTextAlignment center
552+
skinparam backgroundColor #WHITE
553+
554+
title Inserting Stop Point
555+
556+
start
557+
if (number of lane changes is zero?) then (<color:green><b>YES</b></color>)
558+
stop
559+
else (<color:red><b>NO</b></color>)
560+
endif
561+
562+
if (do we want to insert stop point in current lanes?) then (<color:red><b>NO</b></color>)
563+
#LightPink:Insert stop point at next lane change terminal start.;
564+
stop
565+
else (<color:green><b>YES</b></color>)
566+
endif
567+
568+
if (Is there leading object in the current lanes that blocks ego's path?) then (<color:red><b>NO</b></color>)
569+
#LightPink:Insert stop point at terminal stop.;
570+
stop
571+
else (<color:green><b>YES</b></color>)
572+
endif
573+
574+
if (Blocking object's position is after target lane's start position?) then (<color:red><b>NO</b></color>)
575+
#LightPink:Insert stop at the target lane's start position.;
576+
stop
577+
else (<color:green><b>YES</b></color>)
578+
endif
579+
580+
if (Blocking object's position is before terminal stop position?) then (<color:red><b>NO</b></color>)
581+
#LightPink:Insert stop at the terminal stop position;
582+
stop
583+
else (<color:green><b>YES</b></color>)
584+
endif
585+
586+
if (Are there target lane objects between the ego and the blocking object?) then (<color:red><b>NO</b></color>)
587+
#LightGreen:Insert stop behind the blocking object;
588+
stop
589+
else (<color:green><b>YES</b></color>)
590+
#LightPink:Insert stop at terminal stop;
591+
stop
592+
@enduml
593+
```
594+
595+
#### Ego vehicle's stopping position when an object exists ahead
596+
597+
When the ego vehicle encounters an obstacle ahead, it stops while maintaining a safe distance to prepare for a possible lane change. The exact stopping position depends on factors like whether the target lane is clear or if the lane change needs to be delayed. The following explains how different stopping scenarios are handled:
598+
599+
##### When the near the end of the lane change
600+
601+
Whether the target lane has obstacles or is clear, the ego vehicle stops while keeping a safe distance from the obstacle ahead, ensuring there is enough room for the lane change.
551602

552603
![stop_at_terminal_no_block](./images/lane_change-stop_at_terminal_no_block.drawio.svg)
553604

554605
![stop_at_terminal](./images/lane_change-stop_at_terminal.drawio.svg)
555606

556607
##### When the ego vehicle is not near the end of the lane change
557608

558-
If there are NO objects in the lane change section of the target lane, stop by keeping the distance necessary for lane change to the object ahead.
609+
The ego vehicle stops while maintaining a safe distance from the obstacle ahead, ensuring there is enough space for a lane change.
610+
611+
![stop_not_at_terminal_no_blocking_object](./images/lane_change-stop_not_at_terminal_no_blocking_object.drawio.svg)
612+
613+
#### Ego vehicle's stopping position when an object exists in the lane changing section
614+
615+
If there are objects within the lane change section of the target lane, the ego vehicle stops closer to the obstacle ahead, without maintaining the usual distance for a lane change.
616+
617+
##### When near the end of the lane change
618+
619+
Regardless of whether there are obstacles in the target lane, the ego vehicle stops while keeping a safe distance from the obstacle ahead, allowing for the lane change.
620+
621+
![stop_at_terminal_no_block](./images/lane_change-stop_at_terminal_no_block.drawio.svg)
622+
623+
![stop_at_terminal](./images/lane_change-stop_at_terminal.drawio.svg)
624+
625+
##### When not near the end of the lane change
626+
627+
If there are no obstacles in the lane change section of the target lane, the ego vehicle stops while keeping a safe distance from the obstacle ahead to accommodate the lane change.
559628

560629
![stop_not_at_terminal_no_blocking_object](./images/lane_change-stop_not_at_terminal_no_blocking_object.drawio.svg)
561630

562-
If there are objects in the lane change section of the target lane, stop WITHOUT keeping the distance necessary for lane change to the object ahead.
631+
If there are obstacles within the lane change section of the target lane, the ego vehicle stops closer to the obstacle ahead, without keeping the usual distance needed for a lane change.
563632

564633
![stop_not_at_terminal](./images/lane_change-stop_not_at_terminal.drawio.svg)
565634

566-
##### When the target lane is far away
635+
#### When the target lane is far away
567636

568-
When the target lane for lane change is far away and not next to the current lane, do not keep the distance necessary for lane change to the object ahead.
637+
If the target lane for the lane change is far away and not next to the current lane, the ego vehicle stops closer to the obstacle ahead, as maintaining the usual distance for a lane change is not necessary.
569638

570639
![stop_far_from_target_lane](./images/lane_change-stop_far_from_target_lane.drawio.svg)
571640

641+
![stop_not_at_terminal](./images/lane_change-stop_not_at_terminal.drawio.svg)
642+
572643
### Lane Change When Stuck
573644

574645
The ego vehicle is considered stuck if it is stopped and meets any of the following conditions:

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/scene.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ class NormalLaneChange : public LaneChangeBase
7070

7171
void extendOutputDrivableArea(BehaviorModuleOutput & output) const override;
7272

73-
void insertStopPoint(const lanelet::ConstLanelets & lanelets, PathWithLaneId & path) override;
73+
void insert_stop_point(const lanelet::ConstLanelets & lanelets, PathWithLaneId & path) override;
74+
75+
void insert_stop_point_on_current_lanes(PathWithLaneId & path);
7476

7577
PathWithLaneId getReferencePath() const override;
7678

@@ -209,7 +211,7 @@ class NormalLaneChange : public LaneChangeBase
209211

210212
std::pair<double, double> calcCurrentMinMaxAcceleration() const;
211213

212-
void setStopPose(const Pose & stop_pose);
214+
void set_stop_pose(const double arc_length_to_stop_pose, PathWithLaneId & path);
213215

214216
void updateStopTime();
215217

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/utils/base_class.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class LaneChangeBase
127127

128128
virtual void updateSpecialData() {}
129129

130-
virtual void insertStopPoint(
130+
virtual void insert_stop_point(
131131
[[maybe_unused]] const lanelet::ConstLanelets & lanelets,
132132
[[maybe_unused]] PathWithLaneId & path)
133133
{

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/include/autoware/behavior_path_lane_change_module/utils/utils.hpp

+42
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,48 @@ ExtendedPredictedObjects transform_to_extended_objects(
266266
double get_distance_to_next_regulatory_element(
267267
const CommonDataPtr & common_data_ptr, const bool ignore_crosswalk = false,
268268
const bool ignore_intersection = false);
269+
270+
/**
271+
* @brief Calculates the minimum distance to a stationary object in the current lanes.
272+
*
273+
* This function determines the closest distance from the ego vehicle to a stationary object
274+
* in the current lanes. It checks if the object is within the stopping criteria based on its
275+
* velocity and calculates the distance while accounting for the object's size. Only objects
276+
* positioned after the specified distance to the target lane's start are considered.
277+
*
278+
* @param common_data_ptr Pointer to the common data structure containing parameters for lane
279+
* change.
280+
* @param filtered_objects A collection of objects filtered by lanes, including those in the current
281+
* lane.
282+
* @param dist_to_target_lane_start The distance to the start of the target lane from the ego
283+
* vehicle.
284+
* @param path The current path of the ego vehicle, containing path points and lane information.
285+
* @return The minimum distance to a stationary object in the current lanes. If no valid object is
286+
* found, returns the maximum possible double value.
287+
*/
288+
double get_min_dist_to_current_lanes_obj(
289+
const CommonDataPtr & common_data_ptr, const FilteredByLanesExtendedObjects & filtered_objects,
290+
const double dist_to_target_lane_start, const PathWithLaneId & path);
291+
292+
/**
293+
* @brief Checks if there is an object in the target lane that influences the decision to insert a
294+
* stop point.
295+
*
296+
* This function determines whether any objects exist in the target lane that would affect
297+
* the decision to place a stop point behind a blocking object in the current lane.
298+
*
299+
* @param common_data_ptr Pointer to the common data structure containing parameters for the lane
300+
* change.
301+
* @param filtered_objects A collection of objects filtered by lanes, including those in the target
302+
* lane.
303+
* @param stop_arc_length The arc length at which the ego vehicle is expected to stop.
304+
* @param path The current path of the ego vehicle, containing path points and lane information.
305+
* @return true if there is an object in the target lane that influences the stop point decision;
306+
* otherwise, false.
307+
*/
308+
bool has_blocking_target_object(
309+
const CommonDataPtr & common_data_ptr, const FilteredByLanesExtendedObjects & filtered_objects,
310+
const double stop_arc_length, const PathWithLaneId & path);
269311
} // namespace autoware::behavior_path_planner::utils::lane_change
270312

271313
#endif // AUTOWARE__BEHAVIOR_PATH_LANE_CHANGE_MODULE__UTILS__UTILS_HPP_

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/interface.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
154154

155155
BehaviorModuleOutput out = getPreviousModuleOutput();
156156

157-
module_type_->insertStopPoint(module_type_->get_current_lanes(), out.path);
157+
module_type_->insert_stop_point(module_type_->get_current_lanes(), out.path);
158158
out.turn_signal_info = module_type_->get_current_turn_signal_info();
159159

160160
const auto & lane_change_debug = module_type_->getDebugData();

0 commit comments

Comments
 (0)