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.ShapesTopicName",
"ShapesTopic",
47 "Name of the topic on which shapes are reported.");
48 defineOptionalProperty<std::string>(
"ice.ShapesName",
"SegmentAABBs",
49 "Name to use when reporting the extracted shapes.");
51 defineOptionalProperty<float>(
"aabb.OutlierRate", 0.01f,
"Allowed outliers for soft AABBs.")
52 .setMin(0).setMax(0.5);
54 defineOptionalProperty<bool>(
"visu.Enabled",
false,
"Enable visualization of result.");
60 return "SegmentAABBShapesProvider";
94 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
101 ARMARX_VERBOSE <<
"Timeout or error while waiting for point cloud data";
107 const float outlierRate = getProperty<float>(
"aabb.OutlierRate");
110 if (outlierRate > 0 && outlierRate < 1)
119 const semrel::ShapeMap shapeMap = semrel::toShapeMap(
shapes);
120 const semrel::SpatialGraph graph = semrel::spatial::evaluateStaticRelations(shapeMap);
122 debugObserver->setDebugChannel(
getName(),
124 {
"Point Cloud Size",
new armarx::Variant(
static_cast<int>(inputCloud->size())) },
125 {
"Point Cloud Time",
new armarx::Variant(
static_cast<int>(inputCloud->header.stamp)) },
129 const std::string shapesName = getProperty<std::string>(
"ice.ShapesName");
132 if (getProperty<bool>(
"visu.Enabled"))
134 for (
const auto& [
id, box] : shapeMap)
136 std::stringstream ss;
139 box->getPosition(), box->getOrientation(), box->getAABB().extents(),
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.
SegmentAABBShapesProviderPropertyDefinitions(std::string prefix)
static DrawColor getGlasbeyLUTColor(int id, float alpha=1.f)
Get a color from the Glasbey look-up-table.
std::string getDefaultName() const override
void onInitPointCloudProcessor() 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.
void onConnectPointCloudProcessor() override
void onExitPointCloudProcessor() override
data::Graph toIce(const semrel::AttributedGraph &input)
TopicProxyType getTopicFromProperty(const std::string &propertyName)
Get a topic proxy whose name is specified by the given property.
bool waitForPointClouds(int milliseconds=1000)
Wait for new PointClouds.
void drawBox(const VisuID &id, const Eigen::Vector3f &position, const Eigen::Quaternionf &orientation, const Eigen::Vector3f &extents, const DrawColor &color=DEFAULTS.colorBox, bool ignoreLengthScale=false)
Draw a box.
Properties of PointCloudProcessor.
int getPointClouds(const PointCloudPtrT &pointCloudPtr)
Poll PointClouds from provider.
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
void onDisconnectPointCloudProcessor() override
std::string getName() const
Retrieve name of object.
DebugDrawerInterfacePrx getTopic() const
Get the topic.
Property definitions of SegmentAABBShapesProvider.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
MiscLib::Vector< std::pair< MiscLib::RefCountPtr< PrimitiveShape >, size_t > > shapes