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

How to visualize the laser scan data as a local/global map?

asked 2022-01-25 15:45:14 -0500

ymag gravatar image

updated 2022-01-25 16:34:21 -0500

Hi, my robot in ros melodic has a lidar and I want to visualize the laser scan data.

Previously I used the local_costmap, but since it became more complicated and now it consists not only of the laser scan data, I am searching for an alternative how to come to a global map or at least as a previous step, to a local map of a fixed size, similar to what local_costmap would give with only one layer of laser scan data.

I guess this is something common, so there should be already a way of doing this, but my search hasn't led me far. I basically need a map (.png image / OccupancyGrid) of what rviz already could visualize (only laser scan). I would appreciate any help, thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-01-25 16:29:24 -0500

miura gravatar image

I think the package gmappng can be applied.

http://wiki.ros.org/gmapping

edit flag offensive delete link more

Comments

Thank you, yes, gmapping is actually what I was looking for, but how can I do it from a script? I need an image of the global map with laser scan data so to say every two seconds, and I do not overwrite it, I collect them, so do you know how can I write this with python in a script and not from the terminal?

ymag gravatar image ymag  ( 2022-01-28 12:06:40 -0500 )edit

I think you can create a node that keeps subscribing to the map topic and scan topic, and saves it every 2 seconds. I think the content has changed from the original question, so if you want to continue, would you create another question?

miura gravatar image miura  ( 2022-01-29 16:53:17 -0500 )edit
0

answered 2022-01-25 16:27:45 -0500

luchko gravatar image

Hi,
I think that you are looking for map_saver, which can convert costmap into map file.

Costmap cells can vary from "obstacle" to "free" (with "unknown" special case) as explained in the wiki.
map cells are trinary: obstacle, free, unknown. You will see some configuration variables (as occ and free) for map_saver that will let you personalize thresholds if default ones do not suit your needs.

NB: a little indentation / spaces in your question would have been great ;) thanks!

edit flag offensive delete link more

Comments

1

Hi, thank you for the answer and for the tip, I updated my question to be easier to read :). And yes, I am familiar with map_saver, but I have no map topic to subscribe to, I do not want the exact information from local or global costmap, I just want the data from laser scan as a map, but it is not yet in a map form, so that I can just save it with map_saver.

ymag gravatar image ymag  ( 2022-01-28 12:04:17 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-01-25 15:45:14 -0500

Seen: 394 times

Last updated: Jan 25 '22