Author: Jordi Pages <jordi.pages@pal-robotics.com>

Maintainer: Sara Cooper <sara.cooper@pal-robotics.com>

Support: ari-support@pal-robotics.com

Source: https://github.com/pal-robotics/ari_tutorials.git

(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Table segmentation (C++)

Description: Example of plane segmentation applied to the detection of a table and the objects on top of it.

Tutorial Level: INTERMEDIATE

Next Tutorial: Cylinder detector

Purpose

Example of how to use the basic filters of PCL to achieve segmenting a table and all the objects on top of it.

Pre-Requisites

First, make sure that the tutorials are properly installed along with the ARI simulation, as shown in the Tutorials Installation Section.

Execution

Open two consoles and in each one source the workspace

  • cd ~/ari_public_ws
    source ./devel/setup.bash

In the first console launch the simulation

  • $ roslaunch ari_gazebo ari_gazebo.launch public_sim:=true world:=objects_on_table

ARI will be spawn in front of a table with several objects.

gazebo_objects_on_table.jpg

In the second console load an specific file with motion definitions

  • $ rosparam load `rospack find ari_pcl_tutorial`/config/pcl_motions.yaml

Please, be sure that the command worked well. With

  • $ rosparam list

be sure that /play_motion/motions/look_down/... is in the list.

Now run a graphical action client interface

  • $ rosrun actionlib axclient.py /play_motion

axclient_look_down.jpg

In the GUI that shows up write the following text in the Goal text box

  • motion_name: 'look_down'
    skip_planning: True
    priority: 0

And press the SEND GOAL button. The robot will lower the head in order to look at the table.

Close the axclient GUI and now run the following launch command

  • roslaunch ari_pcl_tutorial segment_table.launch

Rviz will appear with ARI in front of a colored point cloud representing the table, the objects on its top and a part of the floor.

rviz_table_segmentation_original.jpg

The segment_table node subscribes to the point cloud obtained by the RGBD camera of ARI's head and applies several filters in order to segment the table. The node first applies a passthrough filter in order to remove the floor points. Then, a downsampling is applied in order to speed up subsequent computations. Afterwards, the main plane, i.e. the table, is located using sample consensus segmentation. Finally, outliers are removed using statistical trimming of those points too far from its neighbours.

The node publishes two additional point clouds:

  • /segment_table/plane
    /segment_table/nonplane

The former topic contains the portion of the original point cloud which has been considered taking part of the table.

rviz_table_segmentation.jpg

The second point cloud contains the points corresponding to object lying on top of the table.

rviz_table_segmentation_objects.jpg

Wiki: Robots/ARI/Tutorials/PointCloud (last edited 2020-02-06 16:12:54 by SaraCooper)