Author: Jordi Pages <email@example.com>
Maintainer: Jordi Pages <firstname.lastname@example.org>
|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
Example of how to use the basic filters of PCL to achieve segmenting a table and all the objects on top of it.
First, make sure that the tutorials are properly installed along with the TIAGo simulation, as shown in the Tutorials Installation Section.
Open two consoles and in each one source the workspace
cd ~/tiago_public_ws source ./devel/setup.bash
In the first console launch the simulation
$ roslaunch tiago_gazebo tiago_gazebo.launch public_sim:=true robot:=steel world:=objects_on_table
TIAGo will be spawn in front of a table with several objects.
Wait until TIAGo has tucked its arm. Then you may proceed with the next steps.
In the second console load an specific file with motion definitions
$ rosparam load `rospack find tiago_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
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 raise its torso and will lower the head in order to look at the table.
Close the axclient GUI and now run the following launch command
roslaunch tiago_pcl_tutorial segment_table.launch
Rviz will appear with TIAGo in front of a colored point cloud representing the table, the objects on its top and a part of the floor.
The segment_table node subscribes to the point cloud obtained by the RGBD camera of TIAGo'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:
The former topic contains the portion of the original point cloud which has been considered taking part of the table.
The second point cloud contains the points corresponding to object lying on top of the table.