30 using namespace CoupledInteractionGroup;
53 Vector3Ptr curVelPlatform = in.getCurrentPlatformVelocity();
57 Eigen::Vector3f targetLeftTcp;
58 Eigen::Vector3f targetRightTcp;
61 Eigen::Vector3f initPlatformPose = in.getInitialPlatformPose()->toEigen();
64 platformPose(0) = poseRef->getDataField(
"positionX")->getFloat();
65 platformPose(1) = poseRef->getDataField(
"positionY")->getFloat();
66 platformPose(2) = poseRef->getDataField(
"rotation")->getFloat();
68 tableTargetPose(0, 3) = tableTarget->x;
69 tableTargetPose(1, 3) = tableTarget->y;
70 tableTargetPose(0, 0) = cos(tableTarget->z);
71 tableTargetPose(0, 1) = -sin(tableTarget->z);
72 tableTargetPose(1, 1) = cos(tableTarget->z);
73 tableTargetPose(1, 0) = -sin(tableTarget->z);
75 ARMARX_INFO <<
"Table Global Pose " << tableTargetPose(0, 3) <<
" " << tableTargetPose(1, 3);
76 tableGlobalPose->changeFrame(context->
getRobot(), context->
getRobot()->getRootNode()->getName());
78 relativeTargetPose = tableGlobalPose->toEigen();
79 ARMARX_INFO <<
"Table Base Pose " << relativeTargetPose(0, 3) <<
" " << relativeTargetPose(1, 3);
80 float maxVelocityTrans = 100.0;
81 float maxVelocityRot = 0.2;
82 float minVelocityTrans = 0.0;
83 float minVelocityRot = 0.0;
84 float finalDistance = (initPlatformPose(0) - tableTarget->x) * (initPlatformPose(0) - tableTarget->x);
85 finalDistance += (initPlatformPose(1) - tableTarget->y) * (initPlatformPose(1) - tableTarget->y);
86 finalDistance =
sqrt(finalDistance);
89 remainingDistance =
sqrt(remainingDistance);
95 Eigen::Vector3f relativeTarget;
112 relativeTarget(0) =
std::max(
std::min((relativeTargetPose(0, 3)), maxVelocityTrans), -maxVelocityTrans);
113 relativeTarget(1) =
std::max(
std::min((relativeTargetPose(1, 3)), maxVelocityTrans), -maxVelocityTrans);
116 if (relativeTarget(0) < minVelocityTrans && relativeTarget(0) > 0)
118 relativeTarget(0) = minVelocityTrans;
120 else if (relativeTarget(0) > -minVelocityTrans && relativeTarget(0) < 0)
122 relativeTarget(0) = -minVelocityTrans;
125 if (relativeTarget(1) < minVelocityTrans && relativeTarget(1) > 0)
127 relativeTarget(1) = minVelocityTrans;
129 else if (relativeTarget(1) > -minVelocityTrans && relativeTarget(1) < 0)
131 relativeTarget(1) = -minVelocityTrans;
134 if (relativeTarget(2) < minVelocityRot && relativeTarget(2) > 0)
136 relativeTarget(2) = minVelocityRot;
138 else if (relativeTarget(2) > -minVelocityRot && relativeTarget(2) < 0)
140 relativeTarget(2) = -minVelocityRot;
144 ARMARX_INFO <<
"Rotating around " << relativeTarget(2) <<
" " << remainingDistance <<
" " << finalDistance <<
" " << tableTarget->z <<
" " <<
platformPose(2);
146 ARMARX_INFO <<
"Current platform Pose " << relativeTargetPose(0, 3) <<
" " << relativeTargetPose(1, 3);
147 Eigen::Vector3f zeroVec;
148 zeroVec << 0.0, 0.0, 0.0;
151 platformPrx->move(0, 30, 0);
190 return "CalculateTargetRobotPose";