Rosanswers logo

Hi, the situation is the next:

We're using a robot to map the indoors of an entire building, and to do that, we use an external 3D sensor. The sensor is on board a mobile robot able to navigate autonomously in the building given a map. So, the map that the robot needs to navigate and to take the sensor to the next position, is obtained in MatLab through several processing of the 3D point cloud from the sensor.

I'm using the new Robotic Systems Toolbox from MatLab to communicate with my robot in ROS, to retrieve information and to give information. In the robot there's enough nodes launched to allow the autonomous navigation, like the map_server (that's the key), the localization and the path planning.

The question is, is there a way to init the map_server without an argument (like an empty map) and be able to write the map from MatLab into the topic each time I get a new map? I've tried to publish my map from MatLab into the map topic, but the map_server overwrites the data inmediately. Maybe I need another node in ROS, only to receive the data from MatLab and able to write this data into an image which I can provide to the map_server node.

If there's something not clear just let me know and I'll try to explain in more detail. Thanks!

Originally posted by S.Prieto on ROS Answers with karma: 258 on 2015-09-14

Post score: 0


1 Answer 1


Rosanswers logo


I think your problem is (if i correctly understood you) that you are using two different maps, the one generated with ROS in the map_server (probably from some of your nav topics) and the one generated with Matlab. The thing is as you said, that when you try to publish your Matlab map in the /map topic it gets overwritten by the one generated with map_server, since map_server is always sending map messges through that topic. So you have different options:

  1. If you want to use both maps, just create a new topic for the Matlab map (/mat_map for example) and send there your map. Then you just need to change the subscribed topics for the nodes that you want to use that map from "/map" to "/mat_map".
  2. If you want to use only the map from matlab, you can just change the topic where map_server poublish the map (/map), to some weird name that no node is gonna use like (/junk_topic). This is a quite bad not optimal solution but is an easy one and works :D. Other option is just delete de map_server node.

Both options asuumes that the map generated with Matlab is in the correct format in ROS (nav_msgs/OccupancyGrid.msg for example).

I hope this helps! :D

Originally posted by donmrsir with karma: 363 on 2015-11-13

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by S.Prieto on 2015-11-16:
Well, I just want to use the map published from MatLab. The problem is that I want everything done from MatLab, to allow anyone who doesn't know anything about ROS to launch the project, so I'll check out how to change the topic in which map_server publishes from MatLab, thank you for you answer!!

Comment by donmrsir on 2015-11-16:
Change the topic, Its quite simple you just need to use the remap option when you launch your Matlab or Map_server node in your launch file, you have some info here. Good luck with the project!


Your Answer

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