25 #include <SemanticObjectRelations/SupportAnalysis/json.h>
39 defineOptionalProperty<std::string>(
"ice.ShapesTopicName",
"ShapesTopic",
40 "Name of the topic on which shapes are reported.");
42 defineOptionalProperty<std::string>(
"ice.SemanticGraphName",
"Support",
43 "Name of the graph when reported to the SemanticGraphStorage topic.");
44 defineOptionalProperty<std::string>(
"ice.SemanticGraphTopicName",
"SemanticGraphTopic",
45 "Name of SemanticGraphStorage topic.");
47 defineOptionalProperty<std::string>(
"ice.RobotStateComponentName",
"RobotStateComponent",
48 "Name of the robot state component.");
50 defineOptionalProperty<std::string>(
"pc.PointCloudFrameName",
GlobalFrame,
51 "Name of the frame of the point cloud coordinates. \n"
52 "Used to determine the gravity vector.");
54 defineOptionalProperty<std::string>(
"ice.DebugObserverName",
"DebugObserver",
55 "Name of the topic the DebugObserver listens to.");
60 defineOptionalProperty<float>(
61 "GR.ContactMargin", 10.,
62 "Distance by which objects are increased for contact computation [mm].")
65 defineOptionalProperty<float>(
66 "GR.VerticalSepPlaneAngleMax", 10.,
67 "Maximal angle [degree] between gravity and separating plane for \n"
68 "separating plane to be considered vertical.")
71 defineOptionalProperty<bool>(
72 "GR.VerticalSepPlaneAssumeSupport",
false,
73 "If true, edges are added if the separating plane is vertical.");
76 defineOptionalProperty<bool>(
78 "Enable or disble uncertainty detection (UD).");
80 defineOptionalProperty<float>(
81 "UD.SupportAreaRatioMin", 0.7f,
82 "Minimal support area ratio of an object to consider it safe.")
83 .setMin(0.).setMax(1.);
90 semrel::VisuLevel::DISABLED);
95 return "ShapesSupportRelations";
112 getProperty(pointCloudFrameName,
"pc.PointCloudFrameName");
114 supportAnalysis.setContactMargin(getProperty<float>(
"GR.ContactMargin"));
115 supportAnalysis.setVertSepPlaneAngleMax(getProperty<float>(
"GR.VerticalSepPlaneAngleMax"));
116 supportAnalysis.setVertSepPlaneAssumeSupport(getProperty<bool>(
"GR.VerticalSepPlaneAssumeSupport"));
118 supportAnalysis.setUncertaintyDetectionEnabled(getProperty<bool>(
"UD.enabled"));
119 supportAnalysis.setSupportAreaRatioMin(getProperty<float>(
"UD.SupportAreaRatioMin"));
130 if (!robotStateComponent)
132 ARMARX_INFO <<
"RobotStateComponent is not available. Global gravity vector "
133 << gravityInGlobal.transpose() <<
" will be used.";
146 robotStateComponent =
nullptr;
156 const std::string& name,
const data::ShapeList& objectsIce,
const Ice::Current&)
159 const semrel::ShapeMap objectsMap = semrel::toShapeMap(objects);
161 std::set<semrel::ShapeID> safeObjectsIDs;
166 std::stringstream graphName;
167 graphName << this->graphName <<
" (" << name <<
")";
168 graphTopic->reportGraph(graphName.str(), graph);
173 const data::ShapeList& objectsIce,
const Ice::LongSeq& safeObjectIDsIce,
const Ice::Current&)
176 const semrel::ShapeMap objectsMap = semrel::toShapeMap(objects);
178 std::set<semrel::ShapeID> safeObjectIDs;
179 for (
long id : safeObjectIDsIce)
181 safeObjectIDs.insert(semrel::ShapeID {
id });
189 const semrel::ShapeMap& objects,
const std::set<semrel::ShapeID>& safeObjectIDs)
192 supportAnalysis.setGravityVector(getGravityFromRobotStateComponent());
195 const semrel::SupportGraph supportGraph = supportAnalysis.performSupportAnalysis(objects, safeObjectIDs);
196 ARMARX_INFO <<
"Support Graph: " << supportGraph.str();
203 Eigen::Vector3f ShapesSupportRelations::getGravityFromRobotStateComponent()
207 return gravityInGlobal;
212 robotStateComponent,
"", {}, VirtualRobot::RobotIO::eStructure);
215 dir.changeFrame(robot, pointCloudFrameName);
216 return dir.toEigen();