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: remove rtc staus when no avoidance candidate is output #1636

Merged
merged 5 commits into from
Aug 22, 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 @@ -83,6 +83,7 @@ class AvoidanceModule : public SceneModuleInterface

RegisteredShiftPointArray left_shift_array_;
RegisteredShiftPointArray right_shift_array_;
UUID candidate_uuid_;
UUID uuid_left_;
UUID uuid_right_;

Expand All @@ -91,11 +92,13 @@ class AvoidanceModule : public SceneModuleInterface
if (candidate.lateral_shift > 0.0) {
rtc_interface_left_.updateCooperateStatus(
uuid_left_, isExecutionReady(), candidate.distance_to_path_change, clock_->now());
candidate_uuid_ = uuid_left_;
return;
}
if (candidate.lateral_shift < 0.0) {
rtc_interface_right_.updateCooperateStatus(
uuid_right_, isExecutionReady(), candidate.distance_to_path_change, clock_->now());
candidate_uuid_ = uuid_right_;
return;
}

Expand Down Expand Up @@ -126,6 +129,15 @@ class AvoidanceModule : public SceneModuleInterface
rtc_interface_right_.clearCooperateStatus();
}

void removeCandidateRTCStatus()
{
if (rtc_interface_left_.isRegistered(candidate_uuid_)) {
rtc_interface_left_.removeCooperateStatus(candidate_uuid_);
} else if (rtc_interface_right_.isRegistered(candidate_uuid_)) {
rtc_interface_right_.removeCooperateStatus(candidate_uuid_);
}
}

void removePreviousRTCStatusLeft()
{
if (rtc_interface_left_.isRegistered(uuid_left_)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2129,6 +2129,7 @@ BehaviorModuleOutput AvoidanceModule::plan()
addShiftPointIfApproved(*new_shift_points);
} else if (isWaitingApproval()) {
clearWaitingApproval();
removeCandidateRTCStatus();
}

// generate path with shift points that have been inserted.
Expand Down Expand Up @@ -2219,6 +2220,9 @@ BehaviorModuleOutput AvoidanceModule::planWaitingApproval()
if (candidate.distance_to_path_change > threshold_to_update_status) {
updateCandidateRTCStatus(candidate);
waitApproval();
} else {
clearWaitingApproval();
removeCandidateRTCStatus();
}
out.path_candidate = std::make_shared<PathWithLaneId>(candidate.path_candidate);
return out;
Expand Down