Go to the documentation of this file.
23 #include <VirtualRobot/VirtualRobot.h>
27 #include <SemanticObjectRelations/Shapes.h>
28 #include <SemanticObjectRelations/Spatial.h>
29 #include <SemanticObjectRelations/RelationGraph/json.h>
43 defineOptionalProperty<std::string>(
"ice.DebugObserverName",
"DebugObserver",
44 "Name of the topic the DebugObserver listens to.");
46 defineOptionalProperty<std::string>(
"ice.SemanticGraphTopicName",
"SemanticGraphTopic",
47 "Name of the topic on which attributed graphs are reported.");
49 defineOptionalProperty<std::string>(
"ice.GraphName",
"Spatial",
50 "Name to use when reporting the extracted graph.");
52 defineOptionalProperty<float>(
"aabb.OutlierRate", 0.01f,
"Allowed outliers for AABBs.");
58 return "SegmentSpatialRelations";
76 enableResultPointClouds<PointT>();
92 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
99 ARMARX_VERBOSE <<
"Timeout or error while waiting for point cloud data";
105 const float outlierRate = getProperty<float>(
"aabb.OutlierRate");
108 if (outlierRate > 0 && outlierRate < 1)
117 const semrel::ShapeMap shapeMap = semrel::toShapeMap(
shapes);
118 const semrel::SpatialGraph graph = semrel::spatial::evaluateStaticRelations(shapeMap);
120 debugObserver->setDebugChannel(
getName(),
122 {
"Point Cloud Size",
new armarx::Variant(
static_cast<int>(inputCloud->size())) },
123 {
"Point Cloud Time",
new armarx::Variant(
static_cast<int>(inputCloud->header.stamp)) },
127 const std::string graphName = getProperty<std::string>(
"ice.GraphName");
The Variant class is described here: Variants.
void offeringTopic(ManagedIceObject &component, const std::string &topicNameOverride="") const
Call offeringTopic([topicName]) on the given component.
semrel::ShapeList getShapesFromSoftAABBs(const pcl::PointCloud< pcl::PointXYZL > &pointCloud, float outlierRatio)
Return the AABBs of each point cloud segment in a pointCloud.
Property definitions of SegmentSpatialRelations.
void onDisconnectPointCloudProcessor() override
void onExitPointCloudProcessor() override
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
semrel::ShapeList getShapesFromAABBs(const pcl::PointCloud< pcl::PointXYZL > &pointCloud)
Get the AABBs of each point cloud segment in pointCloud.
data::Graph toIce(const semrel::AttributedGraph &input)
std::string getDefaultName() const override
TopicProxyType getTopicFromProperty(const std::string &propertyName)
Get a topic proxy whose name is specified by the given property.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
void onConnectPointCloudProcessor() override
Properties of PointCloudProcessor.
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
SegmentSpatialRelationsPropertyDefinitions(std::string prefix)
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
void onInitPointCloudProcessor() override
std::string getName() const
Retrieve name of object.
DebugDrawerInterfacePrx getTopic() const
Get the topic.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > shapes