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

How to publish map continously?

asked 2022-05-26 04:02:19 -0500

electrophod gravatar image

updated 2022-05-26 04:02:39 -0500

I am using map_server out-of-the-box to publish a pre generated map on the topic /map. But it only publishes the map once on the topic. I believe for my application I need it to continuously publish on the topic at a specific rate.

I want to know the following things :
1) What do I do to publish this map continuously? Is there any quick thing I can do with the map_server or do I need to create a node to subscribe and republish?
2) Is it not a good practice to publish a map on a topic synchronously?

Thanks

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2022-05-26 05:02:31 -0500

ljaniec gravatar image

Ad 1) I didn't find this type of function in the code. You can call map_server every time you need it in another subscribed node, save it in that node, and then publish it at a frequency of your choice. You should not call the map service in the publisher callback(!).

Ad 2) I don't think it's a good practice, you should call a map service only when you need it because it puts unnecessary strain on the network.

edit flag offensive delete link more
1

answered 2022-05-26 04:58:54 -0500

joao.aguizo gravatar image

By default the map_server node does not allow that to publish the map continuously, it only publishes the loaded map once on a latched topic. This is due to the assumption that the loaded map by this node is not going to be modified and, usually, if the map is static there is not any good reason to publish it more than once.

To summarize and to provide a bit more information on the topic, unless you have an occupancy grid that is ever changing, for example if you are mapping an unknown region, in which case you would typically not use the map_server anyway, but probably a SLAM approach based node instead (that would handle the update and publishing of the map), it is most likely not an optimal solution to keep publishing the same static map at a given frequency.

However, I do not know your use-case and some assumptions went into this answer... Why would you like to publish the same map with a given frequency? Do you have any specific use-case that you can share?

edit flag offensive delete link more
0

answered 2023-08-10 07:55:03 -0500

Chalaklak gravatar image

The map_server node has a built in service called /change_map (I am just a beginner). Maybe it would help you if you could call this service from within your code at a certain frequency?

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2022-05-26 04:02:19 -0500

Seen: 722 times

Last updated: May 26 '22