Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(behavior_path_planner): fix RTC status update in avoidance module with multiple shift point case #1295

Merged
merged 1 commit into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,20 @@ class AvoidanceModule : public SceneModuleInterface
rtc_interface_right_.clearCooperateStatus();
}

void removePreviousRTCStatusLeft()
{
if (rtc_interface_left_.isRegistered(uuid_left_)) {
rtc_interface_left_.removeCooperateStatus(uuid_left_);
}
}

void removePreviousRTCStatusRight()
{
if (rtc_interface_right_.isRegistered(uuid_right_)) {
rtc_interface_right_.removeCooperateStatus(uuid_right_);
}
}

// data used in previous planning
ShiftedPath prev_output_;
ShiftedPath prev_linear_shift_path_; // used for shift point check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,13 @@ BehaviorModuleOutput AvoidanceModule::plan()
debug_data_.new_shift_points = *new_shift_points;
DEBUG_PRINT("new_shift_points size = %lu", new_shift_points->size());
printShiftPoints(*new_shift_points, "new_shift_points");
if (new_shift_points->back().getRelativeLength() > 0.0) {
removePreviousRTCStatusRight();
} else if (new_shift_points->back().getRelativeLength() < 0.0) {
removePreviousRTCStatusLeft();
} else {
RCLCPP_WARN_STREAM(getLogger(), "Direction is UNKNOWN");
}
addShiftPointIfApproved(*new_shift_points);
} else if (isWaitingApproval()) {
clearWaitingApproval();
Expand Down Expand Up @@ -2189,14 +2196,6 @@ void AvoidanceModule::addShiftPointIfApproved(const AvoidPointArray & shift_poin
// register original points for consistency
registerRawShiftPoints(shift_points);

TurnSignalInfo turn_signal_info;
turn_signal_info.signal_distance = std::numeric_limits<double>::lowest();
if (shift_points.back().getRelativeLength() > 0.0) {
turn_signal_info.turn_signal.command = TurnIndicatorsCommand::ENABLE_LEFT;
} else if (shift_points.back().getRelativeLength() < 0.0) {
turn_signal_info.turn_signal.command = TurnIndicatorsCommand::ENABLE_RIGHT;
}

uuid_left_ = generateUUID();
uuid_right_ = generateUUID();

Expand Down