18 #include "nav2_map_server/costmap_filter_info_server.hpp"
24 namespace nav2_map_server
28 : nav2::LifecycleNode(
"costmap_filter_info_server",
"", options)
39 RCLCPP_INFO(get_logger(),
"Configuring");
42 std::string filter_info_topic = node->declare_or_get_parameter(
43 "filter_info_topic", std::string(
"costmap_filter_info"));
45 publisher_ = this->create_publisher<nav2_msgs::msg::CostmapFilterInfo>(
48 msg_ = nav2_msgs::msg::CostmapFilterInfo();
49 msg_.header.frame_id =
"";
50 msg_.header.stamp = now();
51 msg_.type = node->declare_or_get_parameter(
"type", 0);
52 msg_.filter_mask_topic = node->declare_or_get_parameter(
53 "mask_topic", std::string(
"filter_mask"));
54 msg_.base =
static_cast<float>(
55 node->declare_or_get_parameter(
"base", 0.0));
56 msg_.multiplier =
static_cast<float>(
57 node->declare_or_get_parameter(
"multiplier", 1.0));
59 return nav2::CallbackReturn::SUCCESS;
65 RCLCPP_INFO(get_logger(),
"Activating");
67 publisher_->on_activate();
68 auto costmap_filter_info = std::make_unique<nav2_msgs::msg::CostmapFilterInfo>(msg_);
69 publisher_->publish(std::move(costmap_filter_info));
74 return nav2::CallbackReturn::SUCCESS;
80 RCLCPP_INFO(get_logger(),
"Deactivating");
82 publisher_->on_deactivate();
87 return nav2::CallbackReturn::SUCCESS;
93 RCLCPP_INFO(get_logger(),
"Cleaning up");
97 return nav2::CallbackReturn::SUCCESS;
103 RCLCPP_INFO(get_logger(),
"Shutting down");
105 return nav2::CallbackReturn::SUCCESS;
110 #include "rclcpp_components/register_node_macro.hpp"
void destroyBond()
Destroy bond connection to lifecycle manager.
nav2::LifecycleNode::SharedPtr shared_from_this()
Get a shared pointer of this.
void createBond()
Create bond connection to lifecycle manager.
A QoS profile for latched, reliable topics with a history of 1 messages.
nav2::CallbackReturn on_activate(const rclcpp_lifecycle::State &state) override
Publishes a CostmapFilterInfo message.
nav2::CallbackReturn on_shutdown(const rclcpp_lifecycle::State &state) override
Called when in Shutdown state.
~CostmapFilterInfoServer()
Destructor for the nav2_map_server::CostmapFilterInfoServer.
nav2::CallbackReturn on_cleanup(const rclcpp_lifecycle::State &state) override
Resets publisher.
CostmapFilterInfoServer(const rclcpp::NodeOptions &options=rclcpp::NodeOptions())
Constructor for the nav2_map_server::CostmapFilterInfoServer.
nav2::CallbackReturn on_deactivate(const rclcpp_lifecycle::State &state) override
Deactivates publisher.
nav2::CallbackReturn on_configure(const rclcpp_lifecycle::State &state) override
Creates CostmapFilterInfo publisher and forms published message from ROS parameters.