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

Load map to map_server from MatLab

asked 2015-09-14 05:06:13 -0500

updated 2015-09-14 05:07:04 -0500

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-11-13 05:59:03 -0500

donmrsir gravatar image

Hi!.

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

edit flag offensive delete link more

Comments

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!!

S.Prieto gravatar image S.Prieto  ( 2015-11-16 04:48:39 -0500 )edit

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!

donmrsir gravatar image donmrsir  ( 2015-11-16 05:42:03 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2015-09-14 05:06:13 -0500

Seen: 788 times

Last updated: Nov 13 '15