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

How to fake the data of 2D laser scanner?

asked 2013-08-02 03:25:07 -0600

CroCo gravatar image

It seems that all these kind of sensors are expensive. I wanna understand SLAM by implementing at least "fake" data. I have a point in a virtual environment (OpenGL) represents the position of a robot, so to speak. Now I want to send these "fake" data and visualize them. Is it possible to fake these data? I'm reading a book namely probabilistic robotics which is a very good book, but unfortunately it doesn't cover the practical stuff. Another question, what does the data of 2D laser scanner look like? Any books about this issue ( the communication protocol of 2d laser data)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-08-02 12:54:27 -0600

Zee-Q gravatar image

updated 2013-08-02 13:00:01 -0600

Hi, To simulate the laser data you can do two things.

First, use gazebo simulator there are alot of robots present there for example you can use erratic robot which is equipped with laser range sensor. So after installing the robot and simulator_gazebo you can spawn the robot in a gazebo world by this command.

roslaunch erratic_description  erratic_laser_wg_world.launch

This will bring your gazebo environment with erratic robot in it. It will be publishing topics like /odom /scan /tf which are prerequisites for slam_gmapping. you can run gmapping node and visualize the robot, map and laser scan in Rviz.

Secondly,you can use the bag files which are recorded data sets of different robots in different environment for example willow garage data. After playing your bag file you can run gmapping and visualize the world in rviz.

2d laser data is distance readings in meters from minimum angle normally 0 degree to maximum angle normally 180 degree. The number of readings depend on the resolution of sensor So resolution of 1 degree means you will have a distance measure after every 1 degree. After running any of the above routine you can do rostopic echo /scan and see what is the distance value and in header information you can see the resolution and range etc. That is how a laser range data looks like in ROS Laser Scan.

Edit 1: you can write your own nodes to publish laser data and odometry data. After running one of the above method you will understand the flow. Gmapping needs /scan /odom /tf just made the nodes which publishes these three data in such a way which is acceptable by gmapping.

edit flag offensive delete link more


@Zee-Q, thank you so much. The problem that I'm facing is the compatibility of operating systems, so I'm not able to use ROS, so I'm gonna use another library. I want to simulate SLAM problem, but I didn't find any tutorials about the implementation of it. For example, I have a virtual environment in which there is a point that represents a robot. Now, I can get the x, y and the angle. I want to record the path of moving this point as a first step then I will build obstacles and record everything and based on these data , I will build my SLAM. Based on the book that I'm reading, I need to get the measurements of obstacles and the odometry data. The problem I don't have real sensors, so I need to fake these data but which protocol should I use ...(more)

CroCo gravatar image CroCo  ( 2013-08-05 02:58:55 -0600 )edit

answered 2013-08-02 03:38:01 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

There are some ROS packages dedicated to simulation, like Gazebo. I don't know if it is the kind of things you're looking for.

I don't understand your latest question, what kind of informations are you exactly looking for ? Do you want informations to code your own driver for your laser ? If so, aren't these kind of informations provided by lasers' data-sheet ?

Anyway, if you want to use only ROS independent tools, it is no longer a ROS problem and you might find it difficult to find some help here. :-/

PS : one of the solution to avoid to use an expensive laser sensor some people prefer to use a Kinect (there are even some ROS packages to transform kinect data to a kind of "laser" data)

edit flag offensive delete link more


@Lucile, thanks for the quick response. I'm being forced to use another device which is not compatible with Ubuntu 12.04, so I need to stick with Windows. However, I'm very careful in putting this question in ROS. It is beneficial for both ROS and Windows users. What kind of information do I get from the laser?Is it possible to send fake data (virtual Environment) and simulate SLAM problem?I tried my best to find a good tutorial to familiarize my self with the communication protocol of Laser Scanner, but I didn't.

CroCo gravatar image CroCo  ( 2013-08-02 03:51:09 -0600 )edit

I am sorry, but I can't help you more on this than what I have already answered.

Lucile gravatar image Lucile  ( 2013-08-02 03:56:03 -0600 )edit

Question Tools

1 follower


Asked: 2013-08-02 03:25:07 -0600

Seen: 3,271 times

Last updated: Aug 02 '13