11 platform_control::arondto::MovePlatformToPoseAcceptedType GetDefaultParameterization()
13 platform_control::arondto::MovePlatformToPoseAcceptedType
ret;
14 ret.orientationalAccuracy = 0.1;
15 ret.positionalAccuracy = 100;
21 "MovePlatformToPosition",
"Move a platform unit to target pos.",
23 platform_control::arondto::MovePlatformToPoseAcceptedType::ToAronType(),
24 GetDefaultParameterization().toAron()
29 mixin::RobotReadingSkillMixin(mns),
50 PeriodicSkill::StepResult MovePlatformToPose::step(
const SpecializedMainInput& in)
57 a.pose(in.parameters.pose);
67 ARMARX_WARNING <<
"Unable to get robot from robotstatememory. Abort.";
72 robot->getRootNode()->getName(),
74 auto robotPoseGlobalEigen = robotPose->toGlobalEigen(robot);
76 float targetX = in.parameters.pose(0,3);
77 float targetY = in.parameters.pose(1,3);
80 Eigen::Vector3f targetRotMatX = targetRotMat * Eigen::Vector3f::UnitX();
81 float targetOri = atan2(targetRotMatX[1], targetRotMatX[0]);
84 targetOri = - 2 *
M_PI + targetOri;
87 float robotX = robotPoseGlobalEigen(0,3);
88 float robotY = robotPoseGlobalEigen(1,3);
91 Eigen::Vector3f robotRotMatX = robotRotMat * Eigen::Vector3f::UnitX();
92 float robotOri = atan2(robotRotMatX[1], robotRotMatX[0]);
95 robotOri = - 2 *
M_PI + robotOri;
101 float translationalError = (robotPoseGlobalEigen.block<3,1>(0,3) - Eigen::Vector3f(targetX, targetY, 0)).
norm();
102 float orientationalError = targetOri - robotOri;
105 while (orientationalError < -
M_PI)
107 orientationalError += 2 *
M_PI;
110 while (orientationalError >=
M_PI)
112 orientationalError -= 2 *
M_PI;
118 if (translationalError > in.parameters.positionalAccuracy or orientationalError > in.parameters.orientationalAccuracy)
122 context.
platformUnitPrx->moveTo(targetX, targetY, targetOri, in.parameters.positionalAccuracy*0.8, in.parameters.orientationalAccuracy*0.8);