30 #include <SemanticObjectRelations/SupportAnalysis/json.h>
40 defineOptionalProperty<std::string>(
"ice.ShapesTopicName",
42 "Name of the topic on which shapes are reported.");
44 defineOptionalProperty<std::string>(
45 "ice.SemanticGraphName",
47 "Name of the graph when reported to the SemanticGraphStorage topic.");
48 defineOptionalProperty<std::string>(
"ice.SemanticGraphTopicName",
50 "Name of SemanticGraphStorage topic.");
52 defineOptionalProperty<std::string>(
"ice.RobotStateComponentName",
53 "RobotStateComponent",
54 "Name of the robot state component.");
56 defineOptionalProperty<std::string>(
"pc.PointCloudFrameName",
58 "Name of the frame of the point cloud coordinates. \n"
59 "Used to determine the gravity vector.");
61 defineOptionalProperty<std::string>(
"ice.DebugObserverName",
63 "Name of the topic the DebugObserver listens to.");
68 defineOptionalProperty<float>(
71 "Distance by which objects are increased for contact computation [mm].")
74 defineOptionalProperty<float>(
75 "GR.VerticalSepPlaneAngleMax",
77 "Maximal angle [degree] between gravity and separating plane for \n"
78 "separating plane to be considered vertical.")
81 defineOptionalProperty<bool>(
82 "GR.VerticalSepPlaneAssumeSupport",
84 "If true, edges are added if the separating plane is vertical.");
87 defineOptionalProperty<bool>(
88 "UD.enabled",
true,
"Enable or disble uncertainty detection (UD).");
90 defineOptionalProperty<float>(
91 "UD.SupportAreaRatioMin",
93 "Minimal support area ratio of an object to consider it safe.")
107 return "ShapesSupportRelations";
124 getProperty(pointCloudFrameName,
"pc.PointCloudFrameName");
126 supportAnalysis.setContactMargin(getProperty<float>(
"GR.ContactMargin"));
127 supportAnalysis.setVertSepPlaneAngleMax(getProperty<float>(
"GR.VerticalSepPlaneAngleMax"));
128 supportAnalysis.setVertSepPlaneAssumeSupport(
129 getProperty<bool>(
"GR.VerticalSepPlaneAssumeSupport"));
131 supportAnalysis.setUncertaintyDetectionEnabled(getProperty<bool>(
"UD.enabled"));
132 supportAnalysis.setSupportAreaRatioMin(getProperty<float>(
"UD.SupportAreaRatioMin"));
143 if (!robotStateComponent)
145 ARMARX_INFO <<
"RobotStateComponent is not available. Global gravity vector "
146 << gravityInGlobal.transpose() <<
" will be used.";
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();