
Adding a laser sensor to V-REP
An important feature of robotic simulators is the possibility to simulate sensors as well as robots. We are now going to add a laser sensor to the Pioneer_3dx. V-REP offers different models of vision, inertial, and proximity sensors. These can be selected from the Model Browser panel in the components | sensors section.
To add a laser to the robot, select and drag and drop Hokuyo_URG_04LX_UG01_ROS into the scene. It's useful to put the sensor as a parent of the robot to be facilitated in its correct positioning on the robot frame. After importing the sensor, the Scene Hierarchy should appear, as show in the following figure:

We can position the sensor on the robot frame using the Object/Item position/orientation window, accessible via the toolbar. This laser sensor is already suitable to stream laser data on the /front_scan topic, using a sensor_msgs::LaserScan message. After running the simulation, we can see the data generated by the laser scanner in RViz:
