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);
67 RobotStateComponentInterfacePrx robotStateComponent = getProxy<RobotStateComponentInterfacePrx>(getProperty<std::string>(
"RobotStateComponentName").getValue());
68 remoteRobot.reset(
new RemoteRobot(robotStateComponent->getSynchronizedRobot()));
70 std::string simPrxName = getProperty<std::string>(
"SimulatorName").getValue();
72 if (!simPrxName.empty())
74 simulatorProxy = getProxy<SimulatorInterfacePrx>(simPrxName);
79 VirtualRobot::RobotNodePtr rn = remoteRobot->getRobotNode(referenceFrame);
81 rn = remoteRobot->getRobotNode(tcpNameLeft);
83 rn = remoteRobot->getRobotNode(tcpNameRight);
99 simulatorProxy =
nullptr;
121 bool firstEntryIsLeft = objectClassNames.at(0).find(
"left") != std::string::npos || objectClassNames.at(0).find(
"Left") != std::string::npos;
123 auto agentName = remoteRobot->getName();
124 PosePtr rnPoseLeft = simulatorProxy ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameLeft)) :
new Pose(remoteRobot->getRobotNode(tcpNameLeft)->getGlobalPose());
125 PosePtr rnPoseRight = simulatorProxy ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameRight)) :
new Pose(remoteRobot->getRobotNode(tcpNameRight)->getGlobalPose());
130 Eigen::Matrix4f cameraPose = simulatorProxy ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, referenceFrame))->toEigen() : remoteRobot->getRobotNode(referenceFrame)->getGlobalPose();
131 tcpLeftGlobalPose = cameraPose.inverse() * tcpLeftGlobalPose;
132 tcpRightGlobalPose = cameraPose.inverse() * tcpRightGlobalPose;
146 memoryx::ObjectLocalizationResult result;
147 result.timeStamp = timestamp;
149 memoryx::ObjectLocalizationResultList resultList;
150 result.recognitionCertainty = 1;
152 if (objectClassNames.size() == 1)
154 ARMARX_DEBUG <<
"Returning hand pose from simulator for one hand: " << objectClassNames.at(0);
156 result.objectClassName = objectClassNames.at(0);
158 if (firstEntryIsLeft)
160 result.position = positionLeftHand;
161 result.orientation = orientationLeftHand;
167 result.position = positionRightHand;
168 result.orientation = orientationRightHand;
171 resultList.push_back(result);
173 else if (objectClassNames.size() == 2)
175 ARMARX_INFO <<
"Returning hand pose from simulator for two hands: " << objectClassNames.at(0) <<
", " << objectClassNames.at(1);
177 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(0) : objectClassNames.at(1);
178 result.position = positionLeftHand;
179 result.orientation = orientationLeftHand;
181 resultList.push_back(result);
183 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(1) : objectClassNames.at(0);
184 result.position = positionRightHand;
185 result.orientation = orientationRightHand;
187 resultList.push_back(result);
191 ARMARX_WARNING <<
"More than 2 hands requested - this case is not handeled here";
204 mean.push_back(pos(0));
205 mean.push_back(pos(1));
206 mean.push_back(pos(2));
210 posDist->setMean(
mean);
211 posDist->setCovariance(0, 0, 2.0f);
212 posDist->setCovariance(1, 1, 2.0f);
213 posDist->setCovariance(2, 2, 2.0f);