Adding a 3D vision sensor to V-REP

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) ...

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.