Skip to content

Commit 0ddcca1

Browse files
authored
fix(avoidance): transit rtc cooperate state to FAILED from RUNNING (#6998)
fix(avoidance): transit to FAILED from RUNNING when the module reverts avoidance path Signed-off-by: satoshi-ota <satoshi.ota928@gmail.com>
1 parent a44a173 commit 0ddcca1

File tree

2 files changed

+22
-5
lines changed
  • planning/behavior_path_avoidance_module

2 files changed

+22
-5
lines changed

planning/behavior_path_avoidance_module/include/behavior_path_avoidance_module/scene.hpp

+22-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <rclcpp/node.hpp>
2727
#include <rclcpp/time.hpp>
2828

29+
#include <limits>
2930
#include <memory>
3031
#include <string>
3132
#include <unordered_map>
@@ -138,9 +139,15 @@ class AvoidanceModule : public SceneModuleInterface
138139
void removeCandidateRTCStatus()
139140
{
140141
if (rtc_interface_ptr_map_.at("left")->isRegistered(candidate_uuid_)) {
141-
rtc_interface_ptr_map_.at("left")->removeCooperateStatus(candidate_uuid_);
142-
} else if (rtc_interface_ptr_map_.at("right")->isRegistered(candidate_uuid_)) {
143-
rtc_interface_ptr_map_.at("right")->removeCooperateStatus(candidate_uuid_);
142+
rtc_interface_ptr_map_.at("left")->updateCooperateStatus(
143+
candidate_uuid_, true, State::FAILED, std::numeric_limits<double>::lowest(),
144+
std::numeric_limits<double>::lowest(), clock_->now());
145+
}
146+
147+
if (rtc_interface_ptr_map_.at("right")->isRegistered(candidate_uuid_)) {
148+
rtc_interface_ptr_map_.at("right")->updateCooperateStatus(
149+
candidate_uuid_, true, State::FAILED, std::numeric_limits<double>::lowest(),
150+
std::numeric_limits<double>::lowest(), clock_->now());
144151
}
145152
}
146153

@@ -362,10 +369,21 @@ class AvoidanceModule : public SceneModuleInterface
362369

363370
unlockNewModuleLaunch();
364371

372+
for (const auto & left_shift : left_shift_array_) {
373+
rtc_interface_ptr_map_.at("left")->updateCooperateStatus(
374+
left_shift.uuid, true, State::FAILED, std::numeric_limits<double>::lowest(),
375+
std::numeric_limits<double>::lowest(), clock_->now());
376+
}
377+
378+
for (const auto & right_shift : right_shift_array_) {
379+
rtc_interface_ptr_map_.at("right")->updateCooperateStatus(
380+
right_shift.uuid, true, State::FAILED, std::numeric_limits<double>::lowest(),
381+
std::numeric_limits<double>::lowest(), clock_->now());
382+
}
383+
365384
if (!path_shifter_.getShiftLines().empty()) {
366385
left_shift_array_.clear();
367386
right_shift_array_.clear();
368-
removeRTCStatus();
369387
}
370388

371389
generator_.reset();

planning/behavior_path_avoidance_module/src/scene.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ void AvoidanceModule::updateData()
12831283
void AvoidanceModule::processOnEntry()
12841284
{
12851285
initVariables();
1286-
removeRTCStatus();
12871286
}
12881287

12891288
void AvoidanceModule::processOnExit()

0 commit comments

Comments
 (0)