In this section, we will add another sensor to our mobile robot: an rgb-d sensor, like the one already used in Chapter 4, Simulating Robots Using ROS and Gazebo. V-REP already has a pre-built model for this sensor, but, unlike the laser scanner, it is not directly integrated with ROS. For this reason, let's modify the script associated to this sensor to stream its data via topics. Add the sensor selecting the kinect model from the Model Browser panel and drop it in the robot components. Position the kinect in the desired location and the associated script in the following way:
if (sim_call_type==sim_childscriptcall_initialization) then depthCam=simGetObjectHandle('kinect_depth') depthView=simFloatingViewAdd(0.9,0.9,0.2,0.2,0) ...