ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Create launcher for save_map

asked 2019-01-29 03:12:28 -0600

chbloca gravatar image

updated 2019-01-29 03:40:53 -0600

I wonder how is possible to create a launcher for saving a map after gmapping using a launcher. In my case I create two simultaneous maps. I created a launcher but it is giving the following error:

[map_server-1] process has died [pid 21969, exit code 255, cmd /opt/ros/kinetic/lib/map_server/map_server /home/christen/catkin_ws/src/map_filtering __name:=map_server __log:=/home/christen/.ros/log/058df484-23a4-11e9-b2e5-08002707828c/map_server-1.log].
log file: /home/christen/.ros/log/058df484-23a4-11e9-b2e5-08002707828c/map_server-1*.log
[map_server_2-2] process has died [pid 21970, exit code 255, cmd /opt/ros/kinetic/lib/map_server/map_server /home/christen/catkin_ws/src/map_filtering __name:=map_server_2 __log:=/home/christen/.ros/log/058df484-23a4-11e9-b2e5-08002707828c/map_server_2-2.log].
log file: /home/christen/.ros/log/058df484-23a4-11e9-b2e5-08002707828c/map_server_2-2*.log

The launcher I created is the following:

  <node name="map_server" pkg="map_server" type="map_server" args="$(find map_filtering)">
    <param name="map" value="/map"/>
  <node name="map_server_2" pkg="map_server" type="map_server" args="$(find map_filtering)">
    <param name="map" value="/map_2"/>

with args I understand the directory where the maps are going to be saved, maybe I am wrong.

Do you spot the error? How do I add an argument to save the map with a customized name?

Thanks for your time :)

edit retag flag offensive close merge delete


Are you looking for map saver

curi_ROS gravatar image curi_ROS  ( 2019-01-29 03:30:48 -0600 )edit

instead of rosrun map_server map_saver map:=/map -f my_map I'd like to make a launcher for that.

chbloca gravatar image chbloca  ( 2019-01-29 03:33:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-29 03:47:10 -0600

Delb gravatar image

updated 2019-01-29 03:47:49 -0600

With the args you can specify the output directory yes but you have to specify a full path and a base name. In your question you would overwrite the first map when saving the second one because they would have the same name (the default one). Also you have to use the tag remap because map_saver subscribes to a topic (/map by default) to get the map.

Here is a launch file that do what you want :

    <arg name="map_1" default="/topic_map_1"/>
    <arg name="map_2" default="/topic_map_2"/>
  <node name="map_saver1" pkg="map_server" type="map_saver" args="-f $(find your_pkg)/map_1">
        <remap from="/map" to="$(arg map_1)"/>
  <node name="map_saver2" pkg="map_server" type="map_saver" args="-f $(find your_pkg)/map_2">
    <remap from="/map" to="$(arg map_2)"/>
edit flag offensive delete link more


Thank you for your solution Delb :)

chbloca gravatar image chbloca  ( 2019-01-29 06:49:31 -0600 )edit

Question Tools

1 follower


Asked: 2019-01-29 03:12:28 -0600

Seen: 858 times

Last updated: Jan 29 '19