Table of Contents
Homework: ROS packages for perception
The aim is to create ros packages and set up a small pipeline for finding objects on top of a table offering a service for returning the position and the volume of these. For the sake of simplicity we assume that these objects are clearly separated, meaning that they are spread around the table in an orderly manner, neiter touching nor occluding each other.
Getting started
Please install the system according to the instructions here: https://ai.uni-bremen.de/wiki/software/ros/installation
Before you start workin on the assignment, make sure to have completed the 'beginner level' tutorials from http://www.ros.org/wiki/ROS/Tutorials and you understand how to subscribe to a topic and create a new service and message types.
First steps
We have created a git repository for the code you will develop at:
https://github.com/ai-seminar/group-perception
Add this to your ROS workspace:
rosws set group_perception --git https://github.com/ai-seminar/group-perception.git rosws update source ~/.bashrc
Create the three ROS packages and as a first step commit and push the empty packages to the repository.
Download the bag file from this link.
Package Descriptions
1. perception_pkg
This package is the core of the pipeline. You need to implement three main parts here. First a subscriber to the topic where point clouds are being advertised, then a processing module, where you work on the point cloud that you read in from the topic, and lastly the same node needs to offer a service for returning results.
Subscribe to the topic
As shown in the tutorial. Example code is here
Processing the cloud
Point Clouds should be processed as they are read in, and a buffer of the results should be kept in memory at all time. The processing part of the package is to segment out objects lying on a table and separate each object in a separate cluster. After having done so, you are required to calculate the centroid of each cluster as well as the volume of it (note that all values in PCL are represented in meters.), and store these in a buffer. You will need to advertise a service, which, upon request, will always return the latest results.
Notes on processing the input clouds:
- Start from the code presented in the tutorial (Perception Tutorial)
- You are allowed to filter the cloud on the z axis only between 0 and 1.5 meters
- during plane fitting using RANSAC, make sure you find the correct plane.
- use Euclidean clustering with a distance threshold of 3 cm-s to find the point cluster of each object link
Service for advertising the result
Results should be returned in the message type described in the next section. Upon service call the latest results need be returned. Results are in the form of a list containing (c_centroid, c_volume) pairs, beginning with the largest in a descending order.
2. perception_group_msgs
This package should contain all the message and service type definitions used by the perception_ and perception_client_ packages. You should define a new message type. This is the type that the service, offered by the perception package, will be returning. Call your new message type PerceivedObject. It needs to contain a unique ID, a center point, and the volume of the object. Remember to place the defined message in the msg folder of the current ros pkg, and uncomment the necessary lines in the cmake file, so the necessary files get generated upon rosmake. Note:Center pose needs to be a Point, which is defined in the geometry_msgs package.
You will also need to define a new service in this same package. This service, call it GetClusters, will be able to send a request in the form of a string to the package providing it and its response is going to be a list of PerceivedObject-s
3. perception_client_pkg
This package implements the client side of the pipeline. It is responsible for querying the service for the latest results, and for communicating them to the users. Besides serving as the bridge between users and processing, it is also the entry point for the pipeline, meaning that it needs to offer an easy interface for launching everything that is necessary for the pipeline (roscore, openni, service subscriber etc. )
For questions and clarifications contact balintbe at tzi dot de