Skip to content

Commit

Permalink
fix(avoidance): transit rtc cooperate state to FAILED from RUNNING (#…
Browse files Browse the repository at this point in the history
…6998)

fix(avoidance): transit to FAILED from RUNNING when the module reverts avoidance path

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored May 21, 2024
1 parent a44a173 commit 0ddcca1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <rclcpp/node.hpp>
#include <rclcpp/time.hpp>

#include <limits>
#include <memory>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -138,9 +139,15 @@ class AvoidanceModule : public SceneModuleInterface
void removeCandidateRTCStatus()
{
if (rtc_interface_ptr_map_.at("left")->isRegistered(candidate_uuid_)) {
rtc_interface_ptr_map_.at("left")->removeCooperateStatus(candidate_uuid_);
} else if (rtc_interface_ptr_map_.at("right")->isRegistered(candidate_uuid_)) {
rtc_interface_ptr_map_.at("right")->removeCooperateStatus(candidate_uuid_);
rtc_interface_ptr_map_.at("left")->updateCooperateStatus(
candidate_uuid_, true, State::FAILED, std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::lowest(), clock_->now());
}

if (rtc_interface_ptr_map_.at("right")->isRegistered(candidate_uuid_)) {
rtc_interface_ptr_map_.at("right")->updateCooperateStatus(
candidate_uuid_, true, State::FAILED, std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::lowest(), clock_->now());
}
}

Expand Down Expand Up @@ -362,10 +369,21 @@ class AvoidanceModule : public SceneModuleInterface

unlockNewModuleLaunch();

for (const auto & left_shift : left_shift_array_) {
rtc_interface_ptr_map_.at("left")->updateCooperateStatus(
left_shift.uuid, true, State::FAILED, std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::lowest(), clock_->now());
}

for (const auto & right_shift : right_shift_array_) {
rtc_interface_ptr_map_.at("right")->updateCooperateStatus(
right_shift.uuid, true, State::FAILED, std::numeric_limits<double>::lowest(),
std::numeric_limits<double>::lowest(), clock_->now());
}

if (!path_shifter_.getShiftLines().empty()) {
left_shift_array_.clear();
right_shift_array_.clear();
removeRTCStatus();
}

generator_.reset();
Expand Down
1 change: 0 additions & 1 deletion planning/behavior_path_avoidance_module/src/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,6 @@ void AvoidanceModule::updateData()
void AvoidanceModule::processOnEntry()
{
initVariables();
removeRTCStatus();
}

void AvoidanceModule::processOnExit()
Expand Down

0 comments on commit 0ddcca1

Please sign in to comment.