Skip to content

Commit

Permalink
fix(bpp): keep publishing rtc cooperate status (#6953)
Browse files Browse the repository at this point in the history
Signed-off-by: satoshi-ota <[email protected]>
  • Loading branch information
satoshi-ota authored May 9, 2024
1 parent 473f238 commit 569d56c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ class PlannerManager

module_ptr->updateCurrentState();

module_ptr->publishRTCStatus();

module_ptr->publishSteeringFactor();

module_ptr->publishObjectsOfInterestMarker();
Expand Down Expand Up @@ -323,7 +321,6 @@ class PlannerManager
void deleteExpiredModules(SceneModulePtr & module_ptr) const
{
module_ptr->onExit();
module_ptr->publishRTCStatus();
module_ptr->publishObjectsOfInterestMarker();
module_ptr.reset();
}
Expand Down
6 changes: 4 additions & 2 deletions planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,10 @@ BehaviorModuleOutput PlannerManager::run(const std::shared_ptr<PlannerData> & da
return BehaviorModuleOutput{}; // something wrong.
}();

std::for_each(
manager_ptrs_.begin(), manager_ptrs_.end(), [](const auto & m) { m->updateObserver(); });
std::for_each(manager_ptrs_.begin(), manager_ptrs_.end(), [](const auto & m) {
m->updateObserver();
m->publishRTCStatus();
});

generateCombinedDrivableArea(result_output, data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class SceneModuleInterface

clearWaitingApproval();
removeRTCStatus();
publishRTCStatus();
unlockNewModuleLaunch();
unlockOutputPath();
steering_factor_interface_ptr_->clearSteeringFactors();
Expand All @@ -196,18 +195,6 @@ class SceneModuleInterface
processOnExit();
}

/**
* @brief Publish status if the module is requested to run
*/
void publishRTCStatus()
{
for (const auto & [module_name, ptr] : rtc_interface_ptr_map_) {
if (ptr) {
ptr->publishCooperateStatus(clock_->now());
}
}
}

void publishObjectsOfInterestMarker()
{
for (const auto & [module_name, ptr] : objects_of_interest_marker_interface_ptr_map_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ class SceneModuleManagerInterface
observers_.erase(itr, observers_.end());
}

void publishRTCStatus()
{
for (const auto & [module_name, ptr] : rtc_interface_ptr_map_) {
if (ptr) {
ptr->publishCooperateStatus(rclcpp::Clock(RCL_ROS_TIME).now());
}
}
}

void publishVirtualWall() const
{
using tier4_autoware_utils::appendMarkerArray;
Expand Down Expand Up @@ -235,15 +244,13 @@ class SceneModuleManagerInterface
std::for_each(observers_.begin(), observers_.end(), [](const auto & observer) {
if (!observer.expired()) {
observer.lock()->onExit();
observer.lock()->publishRTCStatus();
}
});

observers_.clear();

if (idle_module_ptr_ != nullptr) {
idle_module_ptr_->onExit();
idle_module_ptr_->publishRTCStatus();
idle_module_ptr_.reset();
}

Expand Down

0 comments on commit 569d56c

Please sign in to comment.