0
$\begingroup$

Rosanswers logo

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:

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

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 :)


Originally posted by chbloca on ROS Answers with karma: 94 on 2019-01-29

Post score: 0


Original comments

Comment by curi_ROS on 2019-01-29:
Are you looking for map saver

Comment by chbloca on 2019-01-29:
instead of rosrun map_server map_saver map:=/map -f my_map I'd like to make a launcher for that.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 :

<launch>
    <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>
  <node name="map_saver2" pkg="map_server" type="map_saver" args="-f $(find your_pkg)/map_2">
    <remap from="/map" to="$(arg map_2)"/>
  </node>
</launch>

Originally posted by Delb with karma: 3907 on 2019-01-29

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by chbloca on 2019-01-29:
Thank you for your solution Delb :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.