30#include <SemanticObjectRelations/SupportAnalysis/json.h>
42 "Name of the topic on which shapes are reported.");
45 "ice.SemanticGraphName",
47 "Name of the graph when reported to the SemanticGraphStorage topic.");
50 "Name of SemanticGraphStorage topic.");
53 "RobotStateComponent",
54 "Name of the robot state component.");
58 "Name of the frame of the point cloud coordinates. \n"
59 "Used to determine the gravity vector.");
63 "Name of the topic the DebugObserver listens to.");
71 "Distance by which objects are increased for contact computation [mm].")
75 "GR.VerticalSepPlaneAngleMax",
77 "Maximal angle [degree] between gravity and separating plane for \n"
78 "separating plane to be considered vertical.")
82 "GR.VerticalSepPlaneAssumeSupport",
84 "If true, edges are added if the separating plane is vertical.");
88 "UD.enabled",
true,
"Enable or disble uncertainty detection (UD).");
91 "UD.SupportAreaRatioMin",
93 "Minimal support area ratio of an object to consider it safe.")
107 return "ShapesSupportRelations";
121 debugDrawer.offeringTopic(*
this);
124 getProperty(pointCloudFrameName,
"pc.PointCloudFrameName");
127 supportAnalysis.setVertSepPlaneAngleMax(
getProperty<float>(
"GR.VerticalSepPlaneAngleMax"));
128 supportAnalysis.setVertSepPlaneAssumeSupport(
143 if (!robotStateComponent)
145 ARMARX_INFO <<
"RobotStateComponent is not available. Global gravity vector "
146 << gravityInGlobal.transpose() <<
" will be used.";
150 debugDrawer.getTopic(*
this);
159 robotStateComponent =
nullptr;
169 const data::ShapeList& objectsIce,
173 const semrel::ShapeMap objectsMap = semrel::toShapeMap(
objects);
175 std::set<semrel::ShapeID> safeObjectsIDs;
180 std::stringstream graphName;
181 graphName << this->graphName <<
" (" << name <<
")";
182 graphTopic->reportGraph(graphName.str(), graph);
187 const Ice::LongSeq& safeObjectIDsIce,
191 const semrel::ShapeMap objectsMap = semrel::toShapeMap(
objects);
193 std::set<semrel::ShapeID> safeObjectIDs;
194 for (
long id : safeObjectIDsIce)
196 safeObjectIDs.insert(semrel::ShapeID{
id});
205 const std::set<semrel::ShapeID>& safeObjectIDs)
208 supportAnalysis.setGravityVector(getGravityFromRobotStateComponent());
211 const semrel::SupportGraph supportGraph =
212 supportAnalysis.performSupportAnalysis(
objects, safeObjectIDs);
213 ARMARX_INFO <<
"Support Graph: " << supportGraph.str();
220 ShapesSupportRelations::getGravityFromRobotStateComponent()
224 return gravityInGlobal;
229 robotStateComponent,
"", {}, VirtualRobot::RobotIO::eStructure);
232 dir.changeFrame(robot, pointCloudFrameName);
233 return dir.toEigen();
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
TopicProxyType getTopicFromProperty(const std::string &propertyName)
Get a topic proxy whose name is specified by the given property.
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
ProxyType getProxyFromProperty(const std::string &propertyName, bool addToDependencies=false, const std::string &endpoints="", bool throwOnProxyError=true)
Get a proxy whose name is specified by the given property.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
std::string getName() const
Retrieve name of object.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
VirtualRobot::RobotPtr createLocalClone()
Clones the structure of this remote robot to a local instance.
Property definitions of ShapesSupportRelations.
ShapesSupportRelationsPropertyDefinitions(std::string prefix)
void onInitComponent() override
void onDisconnectComponent() override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
void onConnectComponent() override
void reportShapes(const std::string &name, const data::ShapeList &objects, const Ice::Current &) override
Topic/pipeline: Extract the support graph for objects and publish it to the graph topic.
void onExitComponent() override
data::Graph extractSupportGraph(const data::ShapeList &objects, const Ice::LongSeq &safeObjectIDs, const Ice::Current &=Ice::emptyCurrent) override
Service: Extract the support graph for objects and return it.
std::string getDefaultName() const override
#define ARMARX_INFO
The normal logging level.
std::string const GlobalFrame
Variable of the global coordinate system.
std::shared_ptr< class Robot > RobotPtr
const std::string visualizationLevelName
void defineVisualizationLevel(armarx::ComponentPropertyDefinitions &defs, const std::string &propertyName=defaults::visualizationLevelName, semrel::VisuLevel defaultLevel=semrel::VisuLevel::RESULT, const std::string &description=defaults::visualizationLevelDescription)
void setMinimumVisuLevel(armarx::PropertyUser &defs, const std::string &propertyName=defaults::visualizationLevelName)
void setArmarXHooksAsImplementation(const DebugDrawerInterfacePrx &debugDrawer, const std::string &logTag="SemanticObjectRelations")
semrel::AttributedGraph fromIce(const semantic::data::Graph &graph)
data::Graph toIce(const semrel::AttributedGraph &input)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.