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

Create launcher for save_map

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

chbloca gravatar image

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

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

edit retag flag offensive close merge delete

Comments

Are you looking for map saver

curi_ROS gravatar image curi_ROS  ( 2019-01-29 03:30:48 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

Delb gravatar image

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

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>
edit flag offensive delete link more

Comments

Thank you for your solution Delb :)

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

Question Tools

1 follower

Stats

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

Seen: 873 times

Last updated: Jan 29 '19