|
PointCloud processors in VisionX allow to retrieve pointclouds from an PointCloudProvider and process them. The visionx::PointCloudProcessor ManagedIceObject is the basic superclass for pointcloud processors. The superclass provides the following features
Integrating a new pointcloud processor is achieved by subclassing the visionx::PointCloudProcessor in the following way:
The methods that need to be implemented are derived from the armarx::ManagedIceObject:
As for every ManagedIceObject, the default name of the object needs to be provided using the getDefaultName() method.
The process method should be used to implement the processing of input pointclouds. It is started in a separate thread once the PointCloudProcessor is fully connected.
The setup of the pointcloud providers needs to be performed in the onInitPointCloudProvider method:
Multiple providers can be used by issuing multiple usingPointCloudProvider() commands.
To enable a result point cloud processer call enableResultPointCloud<PointT>() with the point cloud type as an template argument. The name of the point cloud provider will be set to ExamplePointCloudProviderResult. Capacity for the shared memory segment is determined by using the template parameter and the width and height of the first point cloud provider dependency.
If you want to specify the capacity manually call enableResultPointCloud(yourCapacity); with your size paramater and without an template type. Multiple result point clouds can be enabled via:
In order to process the pointclouds, the pure virtual process method can be implemented and several utility methods can be used to retrieve the pointclouds. The process method is called repeatedly, exit checking is done outside the process method. Consequently, the implementation of the process method should not block or loop but only trigger one processing step.
There are essentially two types of accessing the pointclouds: polling and waiting.
For retrieving pointclouds by polling, the visionx::PointCloudProcessor::getPointClouds can be used in the following way:
The getPointClouds method will return the most recent pointclouds available provided by the PointCloudProvider. This polling method is useful, if the pointcloud processing usually takes much longer then the framerate of input pointclouds.
For retrieving pointclouds by waiting, the visionx::PointCloudProcessor::waitForPointClouds() method can be used
The waitForPointClouds method waits until new pointclouds are available from the provider. This guarantees that a subsequent call to getPointClouds will succeed in reading the pointclouds.