mrpt_map_server

This package provides a ROS 2 node that publishes a static map for other nodes to use it. Unlike classic ROS 1 map_server, this node can publish a range of different metric maps, not only occupancy grids.

README

mrpt_map_server

Table of Contents

Overview

This package provides a ROS 2 node that publishes a static map for other nodes to use it. Unlike classic ROS 1 map_server, this node can publish a range of different metric maps, not only occupancy grids.

Node: mrpt_map_server

Working rationale

The C++ ROS 2 node loads all parameters at start up, loads the map as requested by parameters, and publishes the metric map in the corresponding topics. Messages are automatically re-sent when new subscribers are detected.

There are three formats in which maps can be read:

  1. The preferred format is as an mp2p_icp’s metric map files (*.mm), normally generated via sm2mm from a MRPT “simplemap” (*.simplemap) that comes from a SLAM session, e.g. using the forthcoming package mola_lidar_odometry.

  2. As a ROS standard YAML file. Here, a *.yaml file specifies the metadata of a 2D occupancy gridmap, which is stored as an accompanying image file. The map will be actually encapsulated into a metric_map_t map with layer name map.

  3. As a serialized MRPT metric map file. A *.metricmap file contains any of the existing MRPT metric maps (point clouds, grid maps, etc.), which may come from custom applications or other SLAM packages. The map will be actually encapsulated into a metric_map_t map with layer name map.

So, whatever is the map source, this node will internally build a metric_map_t with one or more map layers, so it gets published in a uniform way to subscribers.

Refer to example launch files at the end of this file for examples of usage of each of these methods.

ROS Parameters

Subscribed topics

None.

Published topics

  • ${pub_mm_topic}/metric_map (Default: mrpt_map/metric_map) (mrpt_msgs::msg::GenericObject) (topic name can be changed with parameter pub_mm_topic).

  • ${pub_mm_topic}/<LAYER_NAME> (Default: mrpt_map/<LAYER_NAME>) (mrpt_msgs::msg::GenericObject)

  • ${pub_mm_topic}/<LAYER_NAME>_points (sensor_msgs::msg::PointCloud2), one per map layer.

  • ${pub_mm_topic}/<LAYER_NAME>_gridmap (nav_msgs::msg::OccupancyGrid)

  • ${pub_mm_topic}/<LAYER_NAME>_gridmap_metadata (nav_msgs::msg::MapMetaData)

  • (… one per map layer …)

If using options 2 or 3 above, there will be just one layer named map.

Template ROS 2 launch files

This package provides launch/mrpt_map_server.launch.py:

ros2 launch mrpt_map_server mrpt_map_server.launch.py

which can be used in user projects to launch the MRPT map server node, by setting these launch arguments:

Demos

Launch a map server from a ROS yaml gridmap (launch file):

ros2 launch mrpt_tutorials demo_map_server_gridmap_from_yaml.launch.py

Launch a map server from a custom .mm map (launch file), which in the launch file is read from the environment variable MM_FILE, so it can be used like:

MM_FILE=/path/to/my/map.mm ros2 launch mrpt_tutorials demo_map_server_from_mm.launch.py