35 #ifndef DWB_CORE__PUBLISHER_HPP_
36 #define DWB_CORE__PUBLISHER_HPP_
42 #include "nav2_costmap_2d/costmap_2d_ros.hpp"
43 #include "dwb_core/trajectory_critic.hpp"
44 #include "dwb_msgs/msg/local_plan_evaluation.hpp"
45 #include "nav_msgs/msg/path.hpp"
46 #include "rclcpp/clock.hpp"
47 #include "rclcpp/publisher.hpp"
48 #include "sensor_msgs/msg/point_cloud2.hpp"
49 #include "visualization_msgs/msg/marker_array.hpp"
50 #include "nav2_ros_common/lifecycle_node.hpp"
51 #include "builtin_interfaces/msg/duration.hpp"
53 using nav2::Publisher;
72 const nav2::LifecycleNode::WeakPtr & parent,
73 const std::string & plugin_name);
75 nav2::CallbackReturn on_configure();
76 nav2::CallbackReturn on_activate();
77 nav2::CallbackReturn on_deactivate();
78 nav2::CallbackReturn on_cleanup();
89 void publishEvaluation(std::shared_ptr<dwb_msgs::msg::LocalPlanEvaluation> results);
90 void publishLocalPlan(
91 const std_msgs::msg::Header & header,
92 const dwb_msgs::msg::Trajectory2D & traj);
94 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros,
95 const std::vector<TrajectoryCritic::Ptr> critics);
96 void publishLocalPlan(
const nav_msgs::msg::Path plan);
99 void publishTrajectories(
const dwb_msgs::msg::LocalPlanEvaluation & results);
102 void publishGenericPlan(
103 const nav_msgs::msg::Path plan,
104 rclcpp::Publisher<nav_msgs::msg::Path> & pub,
bool flag);
107 bool publish_evaluation_;
108 bool publish_local_plan_;
109 bool publish_trajectories_;
110 bool publish_cost_grid_pc_;
111 bool publish_input_params_;
114 builtin_interfaces::msg::Duration marker_lifetime_;
117 std::shared_ptr<Publisher<dwb_msgs::msg::LocalPlanEvaluation>> eval_pub_;
118 std::shared_ptr<Publisher<nav_msgs::msg::Path>> local_pub_;
119 std::shared_ptr<Publisher<visualization_msgs::msg::MarkerArray>> marker_pub_;
120 std::shared_ptr<Publisher<sensor_msgs::msg::PointCloud2>> cost_grid_pc_pub_;
122 nav2::LifecycleNode::WeakPtr node_;
123 rclcpp::Clock::SharedPtr clock_;
124 std::string plugin_name_;
Consolidation of all the publishing logic for the DWB Local Planner.
bool shouldRecordEvaluation()
Does the publisher require that the LocalPlanEvaluation be saved.
void publishEvaluation(std::shared_ptr< dwb_msgs::msg::LocalPlanEvaluation > results)
If the pointer is not null, publish the evaluation and trajectories as needed.