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());
139 Eigen::Matrix4f tcpLeftGlobalPose = rnPoseLeft->toEigen();
140 Eigen::Matrix4f tcpRightGlobalPose = rnPoseRight->toEigen();
143 Eigen::Matrix4f cameraPose =
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;
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;
185 result.positionNoise = computePositionNoise(positionLeftHand->toEigen());
189 result.position = positionRightHand;
190 result.orientation = orientationRightHand;
191 result.positionNoise = computePositionNoise(positionRightHand->toEigen());
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;
203 result.positionNoise = computePositionNoise(positionLeftHand->toEigen());
204 resultList.push_back(result);
206 result.objectClassName = firstEntryIsLeft ? objectClassNames.at(1) : objectClassNames.at(0);
207 result.position = positionRightHand;
208 result.orientation = orientationRightHand;
209 result.positionNoise = computePositionNoise(positionRightHand->toEigen());
210 resultList.push_back(result);
214 ARMARX_WARNING <<
"More than 2 hands requested - this case is not handeled here";