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

how to change map in map_server?

asked 2017-09-03 20:46:06 -0500

marine0131 gravatar image

now if i want to change a map , i need kill the map_server node now running, then start it again with other map name.

is there another way to change map without restart the node?

so thankyou if anything help !

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-09-03 21:43:59 -0500

I explored this same question a while ago, see

As you point out, to load a new map with the current map_server implementation, you need to kill the node and reload it.

A possible solution, that doesn't require any changes in map_server (as proposed by @david-lu), would be to load all your different maps in separate map_server instances renaming appropriately the /map topic on each instance (for example /map_1, /map_2, etc...) and use a multiplexer that subscribes to all your maps and publishes the topic /map depending on which map you want the multiplexer to select.

The other solution would be to modify the source code of map_server and add a service to change the map on demand. Some work has been done, but it hasn't been released yet. If you read through navigation issue #279 you will find the code.

I hope this helps

edit flag offensive delete link more


thankyou so much , i will try the topic_tools/mux, then paste the result.

marine0131 gravatar image marine0131  ( 2017-09-04 00:05:43 -0500 )edit

This is a good solution. I like the idea of multiplexing the map topic for different maps.

jayess gravatar image jayess  ( 2017-09-04 17:47:35 -0500 )edit

@marine0131 did you go for this option, how did you fare? can you share your solution

uffe gravatar image uffe  ( 2018-11-24 13:50:57 -0500 )edit

Anyone tried this approach?

I've tried it, but although the map server is latched, when I select the topic with the mux there is no map. Only when I restart the map server...

Any thoughts on this? Thank you

EFernandes gravatar image EFernandes  ( 2019-02-13 10:00:42 -0500 )edit

You are right, the map server is latched, but since the multiplexer subscribes only once to each topic (when you launch the multiplexer) the map will not be resent through the multiplexer when you select the topic you want to listen to.

Martin Peris gravatar image Martin Peris  ( 2019-02-27 17:57:52 -0500 )edit

Anyway, there seems to be progress on this, check out this PR:

Martin Peris gravatar image Martin Peris  ( 2019-02-27 17:58:18 -0500 )edit

I have the same problem. Has anyone been able to implement this solution? I tried following several suggestions and none worked for me.

jpmf gravatar image jpmf  ( 2023-03-20 17:12:59 -0500 )edit

Question Tools



Asked: 2017-09-03 20:46:06 -0500

Seen: 3,656 times

Last updated: Sep 03 '17