How to export a 2D-map?

Typically: "How do I... ", "How can I... " questions
Post Reply
nika

How to export a 2D-map?

Post 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

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to export a 2D-map?

Post 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

nika

Re: How to export a 2D-map?

Post 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?

Eric
Posts: 186
Joined: 11 Feb 2013, 16:39

Re: How to export a 2D-map?

Post by Eric »

hmmm print screen?

cheers Eric

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to export a 2D-map?

Post 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

nika

Re: How to export a 2D-map?

Post 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.

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: How to export a 2D-map?

Post 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

Post Reply