Working with point cloud to laser scan package

One of the important applications of 3D vision sensors is mimicking the functionalities of a laser scanner. We need the laser scanner data for working with autonomous navigation algorithms such as SLAM. We can make a fake laser scanner using a 3D vision sensor. We can take a slice of point cloud data/depth image and convert it to laser range data. In ROS, we have a set of packages to convert the point cloud to laser scans:

  • depthimage_to_laserscan: This package contains nodes that take the depth image from the vision sensor and generate 2D laser scan based on the provided parameters. The input of the node are depth image and camera info parameters, which include calibration parameters. After conversion to laser scan data, it will publish laser scanner data in the /scan topic. The node parameters are scan_height, scan_time, range_min, range_max, and output frame ID. The official ROS wiki page of this package is http://wiki.ros.org/depthimage_to_laserscan.
  • pointcloud_to_laserscan: This package converts the real point cloud data into 2D laser scan, instead of taking depth image as the previous package. The official wiki page of this package is http://wiki.ros.org/pointcloud_to_laserscan.

The first package is suitable for normal applications; however, if the sensor is placed in an angle, it is better to use the second package. Also, the first package takes less processing than the second one. Here we are using the depthimage_to_laserscan package to convert laser scan. We can install depthimage_to_laserscan using the following commands:

  • In Jade:
    $ sudo apt-get install ros-jade-depthimage-to-laserscan
  • In Indigo:
    $ sudo apt-get install ros-indigo-depthimage-to-laserscan  

We can install the pointcloud_to_laser scanner package using the following commands:

  • In Jade:
    $ sudo apt-get install ros-jade-pointcloud-to-laserscan  
  • In Indigo:
    $ sudo apt-get install ros-indigo-pointcloud-to-laserscan  

We can start converting from the depth image of OpenNI device to 2D laser scanner using the following package.

Creating a package for performing the conversion:

    $ catkin_create_pkg fake_laser_pkg depthimage_to_laserscan nodelet 
roscpp

Create a folder called launch and inside this folder create the following launch file called start_laser.launch. You will get this package and file from the chapter_8_codes/fake_laser_pkg/launch folder.

<launch> 
  <!-- "camera" should uniquely identify the device. All topics 
are pushed down into the "camera" namespace, and it is prepended to tf
frame ids. --> <arg name="camera" default="camera"/> <arg name="publish_tf" default="true"/> ................ ................ <group if="$(arg scan_processing)"> <node pkg="nodelet" type="nodelet"
name="depthimage_to_laserscan" args="load
depthimage_to_laserscan/DepthImageToLaserScanNodelet $(arg
camera)/$(arg camera)_nodelet_manager"> <!-- Pixel rows to use to generate the laserscan. For each
column, the scan willreturn the minimum value for those
pixels centered vertically in the image. --> <param name="scan_height" value="10"/> <param name="output_frame_id" value="/$(arg
camera)_depth_frame"/> <param name="range_min" value="0.45"/> <remap from="image" to="$(arg camera)/$(arg
depth)/image_raw"/> <remap from="scan" to="$(arg scan_topic)"/> .............. .............. </launch>

The following code snippet will launch the nodelet for converting the depth image to laser scanner:

    <node pkg="nodelet" type="nodelet" 
name="depthimage_to_laserscan" args="load
depthimage_to_laserscan/DepthImageToLaserScanNodelet $(arg
camera)/$(arg camera)_nodelet_manager">

Launch this file and we can view the laser scanner in RViz.

Launch this file using the following command:

    $ roslaunch fake_laser_pkg start_laser.launch  

We will see the data in RViz, as shown in the following image:

Figure 13: Laser scan in RViz

Set Fixed Frameas camera_depth_frameand Add the LaserScan in topic /scan.
We can see the laser data in the view port.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.31.240