Ask Your Question

Save a map via a ROS node

asked 2018-11-11 17:44:30 -0600

sachith gravatar image

Hi all,

I'm a ROS noob. I have a use case where I need to save the map (generated via gmapping on rviz), when I receive an event.

The use case is when I've detected 4 objects (turtlebot3), I need to save the image and this should be automated. So cannot use "rosrun map_server map_saver -f ~/map".

Is there anyway I can do this via a ROS node? Basically the same way how the map_server does it?

Thanks, Sachith

edit retag flag offensive close merge delete


You can try a system call within your node to run the map server-save via rosrun.

There are some warnings on the linked page about issues/constraints. YMMV.

billy gravatar image billy  ( 2018-11-12 10:38:33 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-11 23:16:15 -0600

hamid gravatar image

updated 2018-11-11 23:16:34 -0600

you can clone map_server pkg and change what's you need and compile it.
for example you can change this par of code and add a subscriber for save map after you send some data to subscriber

remember you also must change this part of code

 while(!mg.saved_map_ && ros::ok())


edit flag offensive delete link more


This worked. Thanks!

sachith gravatar image sachith  ( 2018-11-12 10:39:54 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2018-11-11 17:44:30 -0600

Seen: 690 times

Last updated: Nov 11 '18