Skip to content

Commit

Permalink
refactor(behavior_path_planner): separate processing time function (#…
Browse files Browse the repository at this point in the history
…5256)

Signed-off-by: Takamasa Horibe <[email protected]>
  • Loading branch information
TakaHoribe authored Oct 11, 2023
1 parent 45339f6 commit 82d9840
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ class PlannerManager
*/
void print() const;

/**
* @brief publish processing time of each module.
*/
void publishProcessingTime() const;

/**
* @brief visit each module and get debug information.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ void BehaviorPathPlannerNode::run()
lk_pd.unlock(); // release planner_data_

planner_manager_->print();
planner_manager_->publishProcessingTime();
planner_manager_->publishMarker();
planner_manager_->publishVirtualWall();
lk_manager.unlock(); // release planner_manager_
Expand Down
10 changes: 8 additions & 2 deletions planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,13 +886,19 @@ void PlannerManager::print() const
string_stream << std::right << "[" << std::setw(max_string_num + 1) << std::left << t.first
<< ":" << std::setw(4) << std::right << t.second << "ms]\n"
<< std::setw(21);
std::string name = std::string("processing_time/") + t.first;
debug_publisher_ptr_->publish<DebugDoubleMsg>(name, t.second);
}

RCLCPP_INFO_STREAM(logger_, string_stream.str());
}

void PlannerManager::publishProcessingTime() const
{
for (const auto & t : processing_time_) {
std::string name = std::string("processing_time/") + t.first;
debug_publisher_ptr_->publish<DebugDoubleMsg>(name, t.second);
}
}

std::shared_ptr<SceneModuleVisitor> PlannerManager::getDebugMsg()
{
debug_msg_ptr_ = std::make_shared<SceneModuleVisitor>();
Expand Down

0 comments on commit 82d9840

Please sign in to comment.