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(avoidance): transit rtc cooperate state to FAILED from RUNNING #6998

Merged
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 @@ -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
@@ -1,4 +1,4 @@
// Copyright 2023 TIER IV, Inc.

Check notice on line 1 in planning/behavior_path_avoidance_module/src/scene.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 1241 to 1240, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1283,7 +1283,6 @@
void AvoidanceModule::processOnEntry()
{
initVariables();
removeRTCStatus();
}

void AvoidanceModule::processOnExit()
Expand Down
Loading