Skip to content

Commit 75fde99

Browse files
mkqudatkimura4zulfaqar-azmi-t4
authored
feat(lane_change): implement terminal lane change feature (#9592)
* implement function to compute terminal lane change path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * push terminal path to candidate paths if no other valid candidate path is found Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * use terminal path in LC interface planWaitingApproval function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set lane changing longitudinal accel to zero for terminal lc path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * rename function Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * chore: rename codeowners file Signed-off-by: tomoya.kimura <tomoya.kimura@tier4.jp> * remove unused member variable prev_approved_path_ Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * refactor stop point insertion for terminal lc path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add flag to enable/disable terminal path feature Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * update README Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add parameter to configure stop point placement Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * compute terminal path only when near terminal start Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add option to disable feature near goal Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * set default flag value to false Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * add documentation for terminal lane change path Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * ensure actual prepare duration is always above minimum prepare duration threshold Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * explicitly return std::nullopt Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * Update planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/scene.cpp Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com> * fix assignment Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix spelling Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> * fix merge errors Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> --------- Signed-off-by: mohammad alqudah <alqudah.mohammad@tier4.jp> Signed-off-by: tomoya.kimura <tomoya.kimura@tier4.jp> Co-authored-by: tomoya.kimura <tomoya.kimura@tier4.jp> Co-authored-by: Zulfaqar Azmi <93502286+zulfaqar-azmi-t4@users.noreply.github.com>
1 parent cd06f62 commit 75fde99

File tree

16 files changed

+283
-59
lines changed

16 files changed

+283
-59
lines changed

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,16 @@ endif
874874
@enduml
875875
```
876876

877+
## Terminal Lane Change Path
878+
879+
Depending on the space configuration around the Ego vehicle, it is possible that a valid LC path cannot be generated. If that happens, then Ego will get stuck at `terminal_start` and will be not be able to proceed. Therefore we introduced the terminal LC path feature; when ego gets near to the terminal point (dist to `terminal_start` is less than the maximum lane change length) a terminal lane changing path will be computed starting from the terminal start point on the current lane and connects to the target lane. The terminal path only needs to be computed once in each execution of LC module. If no valid candidate paths are found in the path generation process, then the terminal path will be used as a fallback candidate path, the safety of the terminal path is not ensured and therefore it can only be force approved. The following images illustrate the expected behavior without and with the terminal path feature respectively:
880+
881+
![no terminal path](./images/lane_change-no_terminal_path.png)
882+
883+
![terminal path](./images/lane_change-terminal_path.png)
884+
885+
Additionally if terminal path feature is enabled and path is computed, stop point placement can be configured to be at the edge of the current lane instead of at the `terminal_start` position, as indicated by the dashed red line in the image above.
886+
877887
## Parameters
878888

879889
### Essential lane change parameters
@@ -935,6 +945,16 @@ The following parameters are used to judge lane change completion.
935945
| `delay_lane_change.min_road_shoulder_width` | [m] | double | Width considered as road shoulder if lane doesn't have road shoulder when checking for parked vehicle | 0.5 |
936946
| `delay_lane_change.th_parked_vehicle_shift_ratio` | [-] | double | Stopped vehicles beyond this distance ratio from center line will be considered as parked | 0.6 |
937947

948+
### Terminal Lane Change Path
949+
950+
The following parameters are used to configure terminal lane change path feature.
951+
952+
| Name | Unit | Type | Description | Default value |
953+
| :-------------------------------- | ---- | ---- | ------------------------------------------------------------------------- | ------------- |
954+
| `terminal_path.enable` | [-] | bool | Flag to enable/disable terminal path feature | true |
955+
| `terminal_path.disable_near_goal` | [-] | bool | Flag to disable terminal path feature if ego is near goal | true |
956+
| `terminal_path.stop_at_boundary` | [-] | bool | If true, ego will stop at current lane boundary instead of middle of lane | false |
957+
938958
### Collision checks
939959

940960
#### Target Objects

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

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
# turn signal
1111
min_length_for_turn_signal_activation: 10.0 # [m]
1212

13+
# terminal path
14+
terminal_path:
15+
enable: true
16+
disable_near_goal: true
17+
stop_at_boundary: false
18+
1319
# trajectory generation
1420
trajectory:
1521
max_prepare_duration: 4.0

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class LaneChangeBase
104104

105105
virtual LaneChangePath getLaneChangePath() const = 0;
106106

107+
virtual BehaviorModuleOutput getTerminalLaneChangePath() const = 0;
108+
107109
virtual bool isEgoOnPreparePhase() const = 0;
108110

109111
virtual bool isRequiredStop(const bool is_trailing_object) = 0;
@@ -130,7 +132,7 @@ class LaneChangeBase
130132

131133
virtual void insert_stop_point(
132134
[[maybe_unused]] const lanelet::ConstLanelets & lanelets,
133-
[[maybe_unused]] PathWithLaneId & path)
135+
[[maybe_unused]] PathWithLaneId & path, [[maybe_unused]] const bool is_waiting_approval = false)
134136
{
135137
}
136138

@@ -285,8 +287,7 @@ class LaneChangeBase
285287
FilteredLanesObjects filtered_objects_{};
286288
BehaviorModuleOutput prev_module_output_{};
287289
PoseWithDetailOpt lane_change_stop_pose_{std::nullopt};
288-
289-
PathWithLaneId prev_approved_path_;
290+
mutable std::optional<LaneChangePath> terminal_lane_change_path_{std::nullopt};
290291

291292
int unsafe_hysteresis_count_{0};
292293
bool is_abort_path_approved_{false};

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

-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ class LaneChangeInterface : public SceneModuleInterface
129129

130130
mutable MarkerArray virtual_wall_marker_;
131131

132-
std::unique_ptr<PathWithLaneId> prev_approved_path_;
133-
134132
void clearAbortApproval() { is_abort_path_approved_ = false; }
135133

136134
bool is_abort_path_approved_{false};

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,18 @@ class NormalLaneChange : public LaneChangeBase
6565

6666
LaneChangePath getLaneChangePath() const override;
6767

68+
BehaviorModuleOutput getTerminalLaneChangePath() const override;
69+
6870
BehaviorModuleOutput generateOutput() override;
6971

7072
void extendOutputDrivableArea(BehaviorModuleOutput & output) const override;
7173

72-
void insert_stop_point(const lanelet::ConstLanelets & lanelets, PathWithLaneId & path) override;
74+
void insert_stop_point(
75+
const lanelet::ConstLanelets & lanelets, PathWithLaneId & path,
76+
const bool is_waiting_approval = false) override;
7377

74-
void insert_stop_point_on_current_lanes(PathWithLaneId & path);
78+
void insert_stop_point_on_current_lanes(
79+
PathWithLaneId & path, const bool is_waiting_approval = false);
7580

7681
PathWithLaneId getReferencePath() const override;
7782

@@ -137,6 +142,8 @@ class NormalLaneChange : public LaneChangeBase
137142
bool check_candidate_path_safety(
138143
const LaneChangePath & candidate_path, const lane_change::TargetObjects & target_objects) const;
139144

145+
std::optional<PathWithLaneId> compute_terminal_lane_change_path() const;
146+
140147
bool isValidPath(const PathWithLaneId & path) const override;
141148

142149
PathSafetyStatus isLaneChangePathSafe(

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

+18
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,22 @@ struct Info
128128
terminal_lane_changing_velocity = _lc_metrics.velocity;
129129
shift_line = _shift_line;
130130
}
131+
132+
void set_prepare(const PhaseMetrics & _prep_metrics)
133+
{
134+
longitudinal_acceleration.prepare = _prep_metrics.actual_lon_accel;
135+
velocity.prepare = _prep_metrics.velocity;
136+
duration.prepare = _prep_metrics.duration;
137+
length.prepare = _prep_metrics.length;
138+
}
139+
140+
void set_lane_changing(const PhaseMetrics & _lc_metrics)
141+
{
142+
longitudinal_acceleration.lane_changing = _lc_metrics.actual_lon_accel;
143+
velocity.lane_changing = _lc_metrics.velocity;
144+
duration.lane_changing = _lc_metrics.duration;
145+
length.lane_changing = _lc_metrics.length;
146+
}
131147
};
132148

133149
struct TargetLaneLeadingObjects
@@ -219,6 +235,8 @@ struct TransientData
219235

220236
double target_lane_length{std::numeric_limits<double>::min()};
221237

238+
double dist_to_target_end{std::numeric_limits<double>::max()};
239+
222240
lanelet::ArcCoordinates current_lanes_ego_arc; // arc coordinates of ego pose along current lanes
223241
lanelet::ArcCoordinates target_lanes_ego_arc; // arc coordinates of ego pose along target lanes
224242

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

+8
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,20 @@ struct DelayParameters
137137
double th_parked_vehicle_shift_ratio{0.6};
138138
};
139139

140+
struct TerminalPathParameters
141+
{
142+
bool enable{false};
143+
bool disable_near_goal{false};
144+
bool stop_at_boundary{false};
145+
};
146+
140147
struct Parameters
141148
{
142149
TrajectoryParameters trajectory{};
143150
SafetyParameters safety{};
144151
CancelParameters cancel{};
145152
DelayParameters delay{};
153+
TerminalPathParameters terminal_path{};
146154

147155
// lane change parameters
148156
double backward_lane_length{200.0};

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

+3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ double calc_dist_to_last_fit_width(
6767
const lanelet::ConstLanelets & lanelets, const Pose & src_pose,
6868
const BehaviorPathPlannerParameters & bpp_param, const double margin = 0.1);
6969

70+
double calc_dist_to_last_fit_width(
71+
const CommonDataPtr & common_data_ptr, const PathWithLaneId & path, const double margin = 0.1);
72+
7073
/**
7174
* @brief Calculates the maximum preparation longitudinal distance for lane change.
7275
*

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ using behavior_path_planner::lane_change::CommonDataPtr;
4848
*/
4949
bool get_prepare_segment(
5050
const CommonDataPtr & common_data_ptr, const PathWithLaneId & prev_module_path,
51-
const LaneChangePhaseMetrics prep_metric, PathWithLaneId & prepare_segment);
51+
const double prep_length, PathWithLaneId & prepare_segment);
5252

5353
/**
5454
* @brief Generates the candidate path for a lane change maneuver.

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/interface.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ LaneChangeInterface::LaneChangeInterface(
4343
std::unique_ptr<LaneChangeBase> && module_type)
4444
: SceneModuleInterface{name, node, rtc_interface_ptr_map, objects_of_interest_marker_interface_ptr_map}, // NOLINT
4545
parameters_{std::move(parameters)},
46-
module_type_{std::move(module_type)},
47-
prev_approved_path_{std::make_unique<PathWithLaneId>()}
46+
module_type_{std::move(module_type)}
4847
{
4948
module_type_->setTimeKeeper(getTimeKeeper());
5049
logger_ = utils::lane_change::getLogger(module_type_->getModuleTypeStr());
@@ -109,7 +108,6 @@ BehaviorModuleOutput LaneChangeInterface::plan()
109108

110109
auto output = module_type_->generateOutput();
111110
path_reference_ = std::make_shared<PathWithLaneId>(output.reference_path);
112-
*prev_approved_path_ = getPreviousModuleOutput().path;
113111

114112
stop_pose_ = module_type_->getStopPose();
115113

@@ -155,11 +153,9 @@ BehaviorModuleOutput LaneChangeInterface::plan()
155153

156154
BehaviorModuleOutput LaneChangeInterface::planWaitingApproval()
157155
{
158-
BehaviorModuleOutput out = getPreviousModuleOutput();
156+
BehaviorModuleOutput out = module_type_->getTerminalLaneChangePath();
159157

160-
*prev_approved_path_ = out.path;
161-
162-
module_type_->insert_stop_point(module_type_->get_current_lanes(), out.path);
158+
module_type_->insert_stop_point(module_type_->get_current_lanes(), out.path, true);
163159
out.turn_signal_info = module_type_->get_current_turn_signal_info();
164160

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

planning/behavior_path_planner/autoware_behavior_path_lane_change_module/src/manager.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ LCParamPtr LaneChangeModuleManager::set_params(rclcpp::Node * node, const std::s
242242
// debug marker
243243
p.publish_debug_marker = getOrDeclareParameter<bool>(*node, parameter("publish_debug_marker"));
244244

245+
// terminal lane change path
246+
p.terminal_path.enable = getOrDeclareParameter<bool>(*node, parameter("terminal_path.enable"));
247+
p.terminal_path.disable_near_goal =
248+
getOrDeclareParameter<bool>(*node, parameter("terminal_path.disable_near_goal"));
249+
p.terminal_path.stop_at_boundary =
250+
getOrDeclareParameter<bool>(*node, parameter("terminal_path.stop_at_boundary"));
251+
245252
// validation of safety check parameters
246253
// if loose check is not enabled, lane change module will keep on chattering and canceling, and
247254
// false positive situation might occur

0 commit comments

Comments
 (0)