Program Listing for File map_server_node.hpp
↰ Return to documentation for file (/tmp/ws/src/mrpt_navigation/mrpt_map/include/mrpt_map/map_server_node.hpp
)
/* +------------------------------------------------------------------------+
| mrpt_navigation |
| |
| Copyright (c) 2014-2023, Individual contributors, see commit authors |
| See: https://github.com/mrpt-ros-pkg/mrpt_navigation |
| All rights reserved. Released under BSD 3-Clause license. See LICENSE |
+------------------------------------------------------------------------+ */
#pragma once
#include <mrpt/config/CConfigFile.h>
#include <mrpt/maps/CMultiMetricMap.h>
#include "nav_msgs/msg/map_meta_data.hpp"
#include "nav_msgs/msg/occupancy_grid.hpp"
#include "nav_msgs/srv/get_map.hpp"
#include "rclcpp/rclcpp.hpp"
class MapServer : public rclcpp::Node
{
public:
MapServer();
~MapServer();
void init();
void loop();
private:
// member variables
double m_frequency{0};
bool m_debug{true};
// params that come from launch file
std::string m_pub_metadata_str;
std::string m_pub_map_ros_str;
std::string m_service_map_str;
// publishers and services
rclcpp::Publisher<nav_msgs::msg::OccupancyGrid>::SharedPtr
m_pub_map_ros;
rclcpp::Publisher<nav_msgs::msg::MapMetaData>::SharedPtr
m_pub_metadata;
rclcpp::Service<nav_msgs::srv::GetMap>::SharedPtr
m_service_map;
nav_msgs::srv::GetMap::Response
m_response_ros;
mrpt::maps::CMultiMetricMap::Ptr
m_metric_map;
void publish_map();
bool map_callback(
const std::shared_ptr<nav_msgs::srv::GetMap::Request> req,
const std::shared_ptr<nav_msgs::srv::GetMap::Response> res);
};