27 #include <VirtualRobot/LinkedCoordinate.h>
30 using namespace FindAndGraspObjectGroup;
44 using namespace Eigen;
48 VirtualRobot::LinkedCoordinate actualPose(robot);
49 actualPose.set(robot->getRobotNodeSet(getInput<std::string>(
"kinematicChainName"))->getTCP()->getName(), Vector3f(0, 0, 0));
50 actualPose.changeFrame(robot->getRootNode());
51 Vector3f actualPosition = actualPose.getPosition();
52 Quaternionf actualOrientation(actualPose.getPose().block<3, 3>(0, 0));
55 VirtualRobot::LinkedCoordinate targetPose =
FramedPose::createLinkedCoordinate(robot, getInput<FramedPosition>(
"targetTCPPosition"), getInput<FramedOrientation>(
"targetTCPOrientation"));
56 targetPose.changeFrame(robot->getRootNode());
57 Vector3f targetPosition = targetPose.getPosition();
58 Quaternionf targetOrientation(targetPose.getPose().block<3, 3>(0, 0));
60 float cartesianDistance = sqrtf(((targetPosition - actualPosition).
dot(targetPosition - actualPosition)));
61 float orientationDistance = actualOrientation.angularDistance(targetOrientation);
63 setOutput(
"TCPDistanceToTarget", cartesianDistance);
64 setOutput(
"TCPOrientationDistanceToTarget", orientationDistance);
65 bool withOri = getInput<bool>(
"ikWithOrientation");
67 if (cartesianDistance <= getInput<float>(
"targetPositionDistanceTolerance") && (!withOri || orientationDistance <= getInput<float>(
"targetOrientationDistanceTolerance")))
73 ARMARX_WARNING <<
"Target pose has not been reached with the desired accuracy. Cartesian distance: " << cartesianDistance <<
", orientation distance: " << orientationDistance <<
" ";
74 ARMARX_INFO <<
"Actual pose: " << actualPose.getPose();
75 ARMARX_INFO <<
"Target pose: " << targetPose.getPose();
85 return "ValidateTcpPose";