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.
Originally posted by Zee-Q with karma: 235 on 2013-08-02
This answer was ACCEPTED on the original site
Post score: 3
Original comments
Comment by CroCo on 2013-08-05:
@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 or in other words which format should I implement my data?