Skip to content

Commit 85cef5a

Browse files
add new status for ego departed
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent d890bb5 commit 85cef5a

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

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

+13-8
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,19 @@ void StartPlannerModule::updateData()
241241
DEBUG_PRINT("StartPlannerModule::updateData() received new route, reset status");
242242
}
243243

244-
constexpr double moving_velocity_threshold = 0.1;
245-
const double & ego_velocity = planner_data_->self_odometry->twist.twist.linear.x;
246244
if (
247245
planner_data_->operation_mode->mode == OperationModeState::AUTONOMOUS &&
248-
status_.driving_forward && !status_.first_engaged_and_driving_forward_time &&
249-
ego_velocity > moving_velocity_threshold) {
246+
status_.driving_forward && !status_.first_engaged_and_driving_forward_time) {
250247
status_.first_engaged_and_driving_forward_time = clock_->now();
251248
}
252249

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+
253257
status_.backward_driving_complete = hasFinishedBackwardDriving();
254258
if (status_.backward_driving_complete) {
255259
updateStatusAfterBackwardDriving();
@@ -1270,10 +1274,8 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12701274
// close to complete its shift, so it wrongly turns off the blinkers, this override helps avoid
12711275
// this issue. Also, if the ego is not engaged (so it is stopped), the blinkers should still be
12721276
// activated.
1273-
const bool override_ego_stopped_check = std::invoke([&]() {
1274-
if (!status_.first_engaged_and_driving_forward_time) {
1275-
return true;
1276-
}
1277+
1278+
const bool geometric_planner_has_not_finished_first_path = std::invoke([&]() {
12771279
if (status_.planner_type != PlannerType::GEOMETRIC) {
12781280
return false;
12791281
}
@@ -1284,6 +1286,9 @@ TurnSignalInfo StartPlannerModule::calcTurnSignalInfo()
12841286
return distance_from_ego_to_stop_point < distance_threshold;
12851287
});
12861288

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

0 commit comments

Comments
 (0)