Skip to content

Commit ec6b9cf

Browse files
danielsanchezarankarishma1911
authored andcommitted
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 df6cca9 commit ec6b9cf

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
@@ -731,10 +731,13 @@ std::pair<TurnSignalInfo, bool> TurnSignalDecider::getBehaviorTurnSignalInfo(
731731
return std::make_pair(TurnSignalInfo{}, true);
732732
}
733733

734-
if (!straddleRoadBound(path, shift_line, current_lanelets, p.vehicle_info)) {
734+
// Check if the ego will cross lane bounds.
735+
// Note that pull out requires blinkers, even if the ego does not cross lane bounds
736+
if (!is_pull_out && !straddleRoadBound(path, shift_line, current_lanelets, p.vehicle_info)) {
735737
return std::make_pair(TurnSignalInfo{}, true);
736738
}
737739

740+
// If the ego has stopped and its close to completing its shift, turn off the blinkers
738741
constexpr double STOPPED_THRESHOLD = 0.1; // [m/s]
739742
if (ego_speed < STOPPED_THRESHOLD && !override_ego_stopped_check) {
740743
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
@@ -247,6 +247,13 @@ void StartPlannerModule::updateData()
247247
status_.first_engaged_and_driving_forward_time = clock_->now();
248248
}
249249

250+
constexpr double moving_velocity_threshold = 0.1;
251+
const double & ego_velocity = planner_data_->self_odometry->twist.twist.linear.x;
252+
if (status_.first_engaged_and_driving_forward_time && ego_velocity > moving_velocity_threshold) {
253+
// Ego is engaged, and has moved
254+
status_.has_departed = true;
255+
}
256+
250257
status_.backward_driving_complete = hasFinishedBackwardDriving();
251258
if (status_.backward_driving_complete) {
252259
updateStatusAfterBackwardDriving();
@@ -1265,8 +1272,10 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12651272
// In Geometric pull out, the ego stops once and then steers the wheels to the opposite direction.
12661273
// This sometimes causes the getBehaviorTurnSignalInfo method to detect the ego as stopped and
12671274
// close to complete its shift, so it wrongly turns off the blinkers, this override helps avoid
1268-
// this issue.
1269-
const bool override_ego_stopped_check = std::invoke([&]() {
1275+
// this issue. Also, if the ego is not engaged (so it is stopped), the blinkers should still be
1276+
// activated.
1277+
1278+
const bool geometric_planner_has_not_finished_first_path = std::invoke([&]() {
12701279
if (status_.planner_type != PlannerType::GEOMETRIC) {
12711280
return false;
12721281
}
@@ -1277,6 +1286,9 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12771286
return distance_from_ego_to_stop_point < distance_threshold;
12781287
});
12791288

1289+
const bool override_ego_stopped_check =
1290+
!status_.has_departed || geometric_planner_has_not_finished_first_path;
1291+
12801292
const auto [new_signal, is_ignore] = planner_data_->getBehaviorTurnSignalInfo(
12811293
path, shift_start_idx, shift_end_idx, current_lanes, current_shift_length,
12821294
status_.driving_forward, egos_lane_is_shifted, override_ego_stopped_check, is_pull_out);

0 commit comments

Comments
 (0)