Skip to content

Commit 11ad7c6

Browse files
fix(start_planner): issue when ego does not straddle lane bounds and starts from 0 speed (autowarefoundation#7004)
* fix issue when ego does not straddle lane bounds and starts from 0 speed Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com> * add new status for ego departed Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com> --------- Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent 3a6742e commit 11ad7c6

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

planning/behavior_path_planner_common/src/turn_signal_decider.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,13 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
738738
return std::make_pair(TurnSignalInfo{}, true);
739739
}
740740

741-
if (!straddleRoadBound(path, shift_line, current_lanelets, p.vehicle_info)) {
741+
// Check if the ego will cross lane bounds.
742+
// Note that pull out requires blinkers, even if the ego does not cross lane bounds
743+
if (!is_pull_out && !straddleRoadBound(path, shift_line, current_lanelets, p.vehicle_info)) {
742744
return std::make_pair(TurnSignalInfo{}, true);
743745
}
744746

747+
// If the ego has stopped and its close to completing its shift, turn off the blinkers
745748
constexpr double STOPPED_THRESHOLD = 0.1; // [m/s]
746749
if (ego_speed < STOPPED_THRESHOLD && !override_ego_stopped_check) {
747750
if (isNearEndOfShift(

planning/behavior_path_start_planner_module/include/behavior_path_start_planner_module/start_planner_module.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ struct PullOutStatus
7474
//! record the first time when ego started forward-driving (maybe after backward driving
7575
//! completion) in AUTONOMOUS operation mode
7676
std::optional<rclcpp::Time> first_engaged_and_driving_forward_time{std::nullopt};
77+
// record if the ego has departed from the start point
78+
bool has_departed{false};
7779

7880
PullOutStatus() {}
7981
};

planning/behavior_path_start_planner_module/src/start_planner_module.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ void StartPlannerModule::updateData()
183183
status_.first_engaged_and_driving_forward_time = clock_->now();
184184
}
185185

186+
constexpr double moving_velocity_threshold = 0.1;
187+
const double & ego_velocity = planner_data_->self_odometry->twist.twist.linear.x;
188+
if (status_.first_engaged_and_driving_forward_time && ego_velocity > moving_velocity_threshold) {
189+
// Ego is engaged, and has moved
190+
status_.has_departed = true;
191+
}
192+
186193
status_.backward_driving_complete = hasFinishedBackwardDriving();
187194
if (status_.backward_driving_complete) {
188195
updateStatusAfterBackwardDriving();
@@ -1212,8 +1219,10 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12121219
// In Geometric pull out, the ego stops once and then steers the wheels to the opposite direction.
12131220
// This sometimes causes the getBehaviorTurnSignalInfo method to detect the ego as stopped and
12141221
// close to complete its shift, so it wrongly turns off the blinkers, this override helps avoid
1215-
// this issue.
1216-
const bool override_ego_stopped_check = std::invoke([&]() {
1222+
// this issue. Also, if the ego is not engaged (so it is stopped), the blinkers should still be
1223+
// activated.
1224+
1225+
const bool geometric_planner_has_not_finished_first_path = std::invoke([&]() {
12171226
if (status_.planner_type != PlannerType::GEOMETRIC) {
12181227
return false;
12191228
}
@@ -1224,6 +1233,9 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12241233
return distance_from_ego_to_stop_point < distance_threshold;
12251234
});
12261235

1236+
const bool override_ego_stopped_check =
1237+
!status_.has_departed || geometric_planner_has_not_finished_first_path;
1238+
12271239
const auto [new_signal, is_ignore] = planner_data_->getBehaviorTurnSignalInfo(
12281240
path, shift_start_idx, shift_end_idx, current_lanes, current_shift_length,
12291241
status_.driving_forward, egos_lane_is_shifted, override_ego_stopped_check, is_pull_out);

0 commit comments

Comments
 (0)