124 const ::memoryx::ObjectClassNameList& objectClassNames,
125 const ::Ice::Current&)
129 bool firstEntryIsLeft = objectClassNames.at(0).find(
"left") != std::string::npos ||
130 objectClassNames.at(0).find(
"Left") != std::string::npos;
132 auto agentName = remoteRobot->getName();
135 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameLeft))
136 :
new Pose(remoteRobot->getRobotNode(tcpNameLeft)->getGlobalPose());
139 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, tcpNameRight))
140 :
new Pose(remoteRobot->getRobotNode(tcpNameRight)->getGlobalPose());
141 Eigen::Matrix4f tcpLeftGlobalPose = rnPoseLeft->toEigen();
142 Eigen::Matrix4f tcpRightGlobalPose = rnPoseRight->toEigen();
145 Eigen::Matrix4f cameraPose =
147 ? PosePtr::dynamicCast(simulatorProxy->getRobotNodePose(agentName, referenceFrame))
149 : remoteRobot->getRobotNode(referenceFrame)->getGlobalPose();
150 tcpLeftGlobalPose = cameraPose.inverse() * tcpLeftGlobalPose;
151 tcpRightGlobalPose = cameraPose.inverse() * tcpRightGlobalPose;
169 memoryx::ObjectLocalizationResult result;
172 memoryx::ObjectLocalizationResultList resultList;
173 result.recognitionCertainty = 1;
175 if (objectClassNames.size() == 1)
177 ARMARX_DEBUG <<
"Returning hand pose from simulator for one hand: "
178 << objectClassNames.at(0);
180 result.objectClassName = objectClassNames.at(0);
182 if (firstEntryIsLeft)
184 result.position = positionLeftHand;
185 result.orientation = orientationLeftHand;
187 result.positionNoise = computePositionNoise(positionLeftHand->toEigen());
191 result.position = positionRightHand;
192 result.orientation = orientationRightHand;
193 result.positionNoise = computePositionNoise(positionRightHand->toEigen());
195 resultList.push_back(result);
197 else if (objectClassNames.size() == 2)
199 ARMARX_INFO <<
"Returning hand pose from simulator for two hands: "
200 << objectClassNames.at(0) <<
", " << objectClassNames.at(1);
202 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(0) : objectClassNames.at(1);
203 result.position = positionLeftHand;
204 result.orientation = orientationLeftHand;
205 result.positionNoise = computePositionNoise(positionLeftHand->toEigen());
206 resultList.push_back(result);
208 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(1) : objectClassNames.at(0);
209 result.position = positionRightHand;
210 result.orientation = orientationRightHand;
211 result.positionNoise = computePositionNoise(positionRightHand->toEigen());
212 resultList.push_back(result);
216 ARMARX_WARNING <<
"More than 2 hands requested - this case is not handeled here";