Page 1 of 1

How to export a 2D-map?

Posted: 21 Nov 2014, 13:38
by nika
Hi,
I need to read the map's information in a ROS node. But how do I export the 3D map created in v-rep as a 2D map? The height is not important, I just need to get the size of the room and the position and size of obstacles. Is this possible?
Thanks
Nika

Re: How to export a 2D-map?

Posted: 21 Nov 2014, 18:27
by coppelia
Hello Nika,

the easiest would be to have a vision sensor over the terrain. Have a look at this simple example. You can adjust the refresh rate of the vision sensor inside of the child script it has attached.

Then, if you need to stream that image to ROS, you could start a publisher with:

Code: Select all

topicName=simExtROS_enablePublisher('visionSensorData',1,simros_strmcmd_get_vision_sensor_image,mapSensor,0,'')
Cheers

Re: How to export a 2D-map?

Posted: 22 Nov 2014, 11:20
by nika
Thanks for your answer. So, as I see it right, I need to have v-rep running to do this? It's ok as long as I use the simulation, but is there an opportunity to use the map's data when running the real system without the simulation?

Re: How to export a 2D-map?

Posted: 22 Nov 2014, 16:06
by Eric
hmmm print screen?

cheers Eric

Re: How to export a 2D-map?

Posted: 22 Nov 2014, 16:33
by coppelia
Well, you can read the map via a customization script also while simulation is not running.
But publishers and subscribers will only run during simulation, except for the info publisher. So you could slightly modify the ROS plugin as to enable the publisher you need also while simulation is not running.

Cheers

Re: How to export a 2D-map?

Posted: 22 Nov 2014, 19:29
by nika
printing the screen doesn't give me the resolution and size of the walls and obstacles. In ROS, I want to use only the map as a costmap2d input. So I'm acutually looking for a solution to extract the static map out of v-rep, the ROS map_server needs the following: "Maps manipulated by the tools in this package are stored in a pair of files. The YAML file describes the map meta-data, and names the image file. The image file encodes the occupancy data."
So I can't just subscribe to a topic, I need the data offline as a 2D picture.

Re: How to export a 2D-map?

Posted: 24 Nov 2014, 10:39
by coppelia
if you need the data offline, as a picture, and a screenshot doesn't work for you, then you could export the data from within your child script. I would suggest a simple binary file for simplicity.

Cheers