Go to the documentation of this file.
25 #include <VirtualRobot/VirtualRobot.h>
32 #include <SemanticObjectRelations/RelationGraph/json.h>
33 #include <SemanticObjectRelations/Shapes.h>
34 #include <SemanticObjectRelations/Spatial.h>
43 defineOptionalProperty<std::string>(
"ice.DebugObserverName",
45 "Name of the topic the DebugObserver listens to.");
47 defineOptionalProperty<std::string>(
"ice.ShapesTopicName",
49 "Name of the topic on which shapes are reported.");
50 defineOptionalProperty<std::string>(
51 "ice.ShapesName",
"SegmentAABBs",
"Name to use when reporting the extracted shapes.");
53 defineOptionalProperty<float>(
"aabb.OutlierRate", 0.01f,
"Allowed outliers for soft AABBs.")
57 defineOptionalProperty<bool>(
"visu.Enabled",
false,
"Enable visualization of result.");
63 return "SegmentAABBShapesProvider";
98 pcl::PointCloud<PointT>::Ptr inputCloud(
new pcl::PointCloud<PointT>());
105 ARMARX_VERBOSE <<
"Timeout or error while waiting for point cloud data";
111 const float outlierRate = getProperty<float>(
"aabb.OutlierRate");
114 if (outlierRate > 0 && outlierRate < 1)
123 const semrel::ShapeMap shapeMap = semrel::toShapeMap(
shapes);
124 const semrel::SpatialGraph graph = semrel::spatial::evaluateStaticRelations(shapeMap);
126 debugObserver->setDebugChannel(
129 {
"Point Cloud Size",
new armarx::Variant(
static_cast<int>(inputCloud->size()))},
135 const std::string shapesName = getProperty<std::string>(
"ice.ShapesName");
138 if (getProperty<bool>(
"visu.Enabled"))
140 for (
const auto& [
id, box] : shapeMap)
142 std::stringstream ss;
146 box->getOrientation(),
147 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