11 platform_control::arondto::MovePlatformToPoseAcceptedType
12 GetDefaultParameterization()
14 platform_control::arondto::MovePlatformToPoseAcceptedType
ret;
15 ret.orientationalAccuracy = 0.1;
16 ret.positionalAccuracy = 100;
22 "MovePlatformToPosition",
23 "Move a platform unit to target pos.",
26 platform_control::arondto::MovePlatformToPoseAcceptedType::ToAronType(),
27 GetDefaultParameterization().toAron()};
33 mixin::RobotReadingSkillMixin(mns),
34 PeriodicSimpleSpecializedSkill<
ArgType>(Description,
57 PeriodicSkill::StepResult
58 MovePlatformToPose::step(
const SpecializedMainInput& in)
65 a.pose(in.parameters.pose);
75 VirtualRobot::RobotIO::RobotDescription::eStructure);
78 ARMARX_WARNING <<
"Unable to get robot from robotstatememory. Abort.";
83 robot->getRootNode()->getName(),
85 auto robotPoseGlobalEigen = robotPose->toGlobalEigen(robot);
87 float targetX = in.parameters.pose(0, 3);
88 float targetY = in.parameters.pose(1, 3);
91 Eigen::Vector3f targetRotMatX = targetRotMat * Eigen::Vector3f::UnitX();
92 float targetOri = atan2(targetRotMatX[1], targetRotMatX[0]);
95 targetOri = -2 *
M_PI + targetOri;
98 float robotX = robotPoseGlobalEigen(0, 3);
99 float robotY = robotPoseGlobalEigen(1, 3);
102 Eigen::Vector3f robotRotMatX = robotRotMat * Eigen::Vector3f::UnitX();
103 float robotOri = atan2(robotRotMatX[1], robotRotMatX[0]);
106 robotOri = -2 *
M_PI + robotOri;
110 <<
", " << robotOri <<
")";
112 <<
", " << targetOri <<
")";
114 float translationalError =
115 (robotPoseGlobalEigen.block<3, 1>(0, 3) - Eigen::Vector3f(targetX, targetY, 0)).
norm();
116 float orientationalError = targetOri - robotOri;
119 while (orientationalError < -
M_PI)
121 orientationalError += 2 *
M_PI;
124 while (orientationalError >=
M_PI)
126 orientationalError -= 2 *
M_PI;
132 << orientationalError <<
")";
134 if (translationalError > in.parameters.positionalAccuracy or
135 orientationalError > in.parameters.orientationalAccuracy)
138 << in.parameters.positionalAccuracy <<
")";
140 << in.parameters.orientationalAccuracy <<
")";
144 in.parameters.positionalAccuracy * 0.8,
145 in.parameters.orientationalAccuracy * 0.8);