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(behavior_path_planner): print avoidance and lane change debug message (#4058) #621

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 @@ -231,10 +231,8 @@ class BehaviorPathPlannerNode : public rclcpp::Node
/**
* @brief publish debug messages
*/
#ifdef USE_OLD_ARCHITECTURE
void publishSceneModuleDebugMsg(
const std::shared_ptr<SceneModuleVisitor> & debug_messages_data_ptr);
#endif

/**
* @brief publish path candidate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "behavior_path_planner/scene_module/scene_module_interface.hpp"
#include "behavior_path_planner/scene_module/scene_module_manager_interface.hpp"
#include "behavior_path_planner/scene_module/scene_module_visitor.hpp"
#include "behavior_path_planner/utils/lane_following/module_data.hpp"

#include <lanelet2_extension/utility/utilities.hpp>
Expand Down Expand Up @@ -225,6 +226,11 @@ class PlannerManager
*/
void print() const;

/**
* @brief visit each module and get debug information.
*/
std::shared_ptr<SceneModuleVisitor> getDebugMsg();

private:
/**
* @brief run the module and publish RTC status.
Expand Down Expand Up @@ -461,6 +467,8 @@ class PlannerManager

mutable std::vector<ModuleUpdateInfo> debug_info_;

mutable std::shared_ptr<SceneModuleVisitor> debug_msg_ptr_;

bool verbose_{false};
};
} // namespace behavior_path_planner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,7 @@ void BehaviorPathPlannerNode::run()
publishPathCandidate(bt_manager_->getSceneModules(), planner_data_);
publishSceneModuleDebugMsg(bt_manager_->getAllSceneModuleDebugMsgData());
#else
publishSceneModuleDebugMsg(planner_manager_->getDebugMsg());
publishPathCandidate(planner_manager_->getSceneModuleManagers(), planner_data_);
publishPathReference(planner_manager_->getSceneModuleManagers(), planner_data_);
stop_reason_publisher_->publish(planner_manager_->getStopReasons());
Expand Down Expand Up @@ -1390,7 +1391,6 @@ void BehaviorPathPlannerNode::publish_bounds(const PathWithLaneId & path)
bound_publisher_->publish(msg);
}

#ifdef USE_OLD_ARCHITECTURE
void BehaviorPathPlannerNode::publishSceneModuleDebugMsg(
const std::shared_ptr<SceneModuleVisitor> & debug_messages_data_ptr)
{
Expand All @@ -1404,7 +1404,6 @@ void BehaviorPathPlannerNode::publishSceneModuleDebugMsg(
debug_lane_change_msg_array_publisher_->publish(*lane_change_debug_message);
}
}
#endif

#ifdef USE_OLD_ARCHITECTURE
void BehaviorPathPlannerNode::publishPathCandidate(
Expand Down
13 changes: 13 additions & 0 deletions planning/behavior_path_planner/src/planner_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,17 @@ void PlannerManager::print() const
RCLCPP_INFO_STREAM(logger_, string_stream.str());
}

std::shared_ptr<SceneModuleVisitor> PlannerManager::getDebugMsg()
{
debug_msg_ptr_ = std::make_shared<SceneModuleVisitor>();
for (const auto & approved_module : approved_module_ptrs_) {
approved_module->acceptVisitor(debug_msg_ptr_);
}

for (const auto & candidate_module : candidate_module_ptrs_) {
candidate_module->acceptVisitor(debug_msg_ptr_);
}
return debug_msg_ptr_;
}

} // namespace behavior_path_planner