47 usingProxy(getProperty<std::string>(
"RobotStateComponentName").getValue());
48 tcpNameLeft = getProperty<std::string>(
"TCPNameLeft").getValue();
49 tcpNameRight = getProperty<std::string>(
"TCPNameRight").getValue();
50 referenceFrame = getProperty<std::string>(
"ReferenceFrameName").getValue();
52 std::string simPrxName = getProperty<std::string>(
"SimulatorName").getValue();
54 if (!simPrxName.empty())
56 usingProxy(simPrxName);
68 getProxy<RobotStateComponentInterfacePrx>(
69 getProperty<std::string>(
"RobotStateComponentName").getValue());
70 remoteRobot.reset(
new RemoteRobot(robotStateComponent->getSynchronizedRobot()));
72 std::string simPrxName = getProperty<std::string>(
"SimulatorName").getValue();
74 if (!simPrxName.empty())
76 simulatorProxy = getProxy<SimulatorInterfacePrx>(simPrxName);
81 VirtualRobot::RobotNodePtr rn = remoteRobot->getRobotNode(referenceFrame);
83 rn = remoteRobot->getRobotNode(tcpNameLeft);
85 rn = remoteRobot->getRobotNode(tcpNameRight);
102 simulatorProxy =
nullptr;
120 memoryx::ObjectLocalizationResultList
122 const ::memoryx::ObjectClassNameList& objectClassNames,
123 const ::Ice::Current&)
127 bool firstEntryIsLeft = objectClassNames.at(0).find(
"left") != std::string::npos ||
128 objectClassNames.at(0).find(
"Left") != std::string::npos;
130 auto agentName = remoteRobot->getName();
133 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameLeft))
134 :
new Pose(remoteRobot->getRobotNode(tcpNameLeft)->getGlobalPose());
137 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameRight))
138 :
new Pose(remoteRobot->getRobotNode(tcpNameRight)->getGlobalPose());
145 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, referenceFrame))
147 : remoteRobot->getRobotNode(referenceFrame)->getGlobalPose();
148 tcpLeftGlobalPose = cameraPose.inverse() * tcpLeftGlobalPose;
149 tcpRightGlobalPose = cameraPose.inverse() * tcpRightGlobalPose;
167 memoryx::ObjectLocalizationResult result;
168 result.timeStamp = timestamp;
170 memoryx::ObjectLocalizationResultList resultList;
171 result.recognitionCertainty = 1;
173 if (objectClassNames.size() == 1)
175 ARMARX_DEBUG <<
"Returning hand pose from simulator for one hand: "
176 << objectClassNames.at(0);
178 result.objectClassName = objectClassNames.at(0);
180 if (firstEntryIsLeft)
182 result.position = positionLeftHand;
183 result.orientation = orientationLeftHand;
189 result.position = positionRightHand;
190 result.orientation = orientationRightHand;
193 resultList.push_back(result);
195 else if (objectClassNames.size() == 2)
197 ARMARX_INFO <<
"Returning hand pose from simulator for two hands: "
198 << objectClassNames.at(0) <<
", " << objectClassNames.at(1);
200 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(0) : objectClassNames.at(1);
201 result.position = positionLeftHand;
202 result.orientation = orientationLeftHand;
204 resultList.push_back(result);
206 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(1) : objectClassNames.at(0);
207 result.position = positionRightHand;
208 result.orientation = orientationRightHand;
210 resultList.push_back(result);
214 ARMARX_WARNING <<
"More than 2 hands requested - this case is not handeled here";
224 RobotHandLocalizationDynamicSimulation::computePositionNoise(
const Eigen::Vector3f& pos)
227 mean.push_back(pos(0));
228 mean.push_back(pos(1));
229 mean.push_back(pos(2));
233 posDist->setMean(
mean);
234 posDist->setCovariance(0, 0, 2.0f);
235 posDist->setCovariance(1, 1, 2.0f);
236 posDist->setCovariance(2, 2, 2.0f);