Skip to content

Commit

Permalink
feat(lane_change): enable force execution under unsafe conditions (au…
Browse files Browse the repository at this point in the history
…towarefoundation#8131)

add force execution conditions

Signed-off-by: Go Sakayori <[email protected]>
  • Loading branch information
go-sakayori authored Jul 22, 2024
1 parent 905b74a commit 8b8f180
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,18 @@ BehaviorModuleOutput LaneChangeInterface::plan()
} else {
const auto path =
assignToCandidate(module_type_->getLaneChangePath(), module_type_->getEgoPosition());
updateRTCStatus(
path.start_distance_to_path_change, path.finish_distance_to_path_change, true,
State::RUNNING);
const auto force_activated = std::any_of(
rtc_interface_ptr_map_.begin(), rtc_interface_ptr_map_.end(),
[&](const auto & rtc) { return rtc.second->isForceActivated(uuid_map_.at(rtc.first)); });
if (!force_activated) {
updateRTCStatus(
path.start_distance_to_path_change, path.finish_distance_to_path_change, true,
State::RUNNING);
} else {
updateRTCStatus(
path.start_distance_to_path_change, path.finish_distance_to_path_change, false,
State::RUNNING);
}
}

return output;
Expand Down Expand Up @@ -227,6 +236,15 @@ bool LaneChangeInterface::canTransitFailureState()
updateDebugMarker();
log_debug_throttled(__func__);

const auto force_activated = std::any_of(
rtc_interface_ptr_map_.begin(), rtc_interface_ptr_map_.end(),
[&](const auto & rtc) { return rtc.second->isForceActivated(uuid_map_.at(rtc.first)); });

if (force_activated) {
RCLCPP_WARN_THROTTLE(getLogger(), *clock_, 5000, "unsafe but force executed");
return false;
}

if (module_type_->isAbortState() && !module_type_->hasFinishedAbort()) {
log_debug_throttled("Abort process has on going.");
return false;
Expand Down

0 comments on commit 8b8f180

Please sign in to comment.