Skip to content

Commit

Permalink
fix(avoidance): transit to FAILED from RUNNING when the module revert…
Browse files Browse the repository at this point in the history
…s avoidance path

Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota committed May 16, 2024
1 parent 8526341 commit 209f407
Showing 1 changed file with 22 additions and 3 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,6 +369,18 @@ 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();
Expand Down

0 comments on commit 209f407

Please sign in to comment.