32 using namespace PlatformGroup;
46 if (!in.getUsePlatformNativeController())
51 auto pose = in.getRelativePose();
56 float posX = posXRef->getDataField()->getFloat();
57 float posY = posYRef->getDataField()->getFloat();
58 float ori = oriRef->getDataField()->getFloat();
60 Eigen::Vector3f localPos {pose->x, pose->y, 0};
62 m = Eigen::AngleAxisf(ori, Eigen::Vector3f::UnitZ());
63 Eigen::Vector3f globalPos = m * localPos;
67 pose->z -=
M_PI * 2.0;
72 pose->z +=
M_PI * 2.0;
75 float targetX = posX + globalPos[0];
76 float targetY = posY + globalPos[1];
77 float targetOri = ori + pose->z;
81 targetOri +=
M_PI * 2.0;
84 while (targetOri >
M_PI * 2.0)
86 targetOri -=
M_PI * 2.0;
89 ARMARX_INFO <<
"Relative target pose: " << pose->toEigen().transpose();
90 ARMARX_INFO <<
"Global target pose: " << targetX <<
" " << targetY <<
" " << targetOri;
91 local.setAbsoluteTargetPosition(
new Vector3(targetX, targetY, targetOri));
97 std::string platformDatafieldName = in.getPlatformPoseDatafieldName();
102 auto relativeTargetPose = in.getRelativePose();
105 datafields.at(1)->getFloat() + relativeTargetPose->y,
110 Literal checkX(*posXId, checks::approx, {
target->x, in.getPositionalAccuracy()});
111 Literal checkY(*posYId, checks::approx, {
target->y, in.getPositionalAccuracy()});
113 Literal checkAngle(*rotId, checks::approx, {
target->z, in.getOrientationalAccuracy()});
115 float checkAngleValueOffset;
119 checkAngleValueOffset = - 2 *
M_PI;
123 checkAngleValueOffset = 2 *
M_PI;
126 Literal checkAngle2(rotId, checks::approx, { (
float)(
target->z + checkAngleValueOffset), in.getOrientationalAccuracy()});
128 installConditionForTargetReached(checkX && checkY && (checkAngle || checkAngle2));
129 setTimeoutEvent(in.getTimeout(), this->createEventTimeout());
137 std::string platformDatafieldName = in.getPlatformPoseDatafieldName();
138 if (in.getUsePlatformNativeController())
145 auto relativeTargetPose = in.getRelativePose();
147 datafields.at(1)->getFloat() + relativeTargetPose->y,
149 context->
platformUnitPrx->moveRelative(relativeTargetPose->x, relativeTargetPose->y, relativeTargetPose->z, in.getPositionalAccuracy(), in.getOrientationalAccuracy());
154 Eigen::Vector2f currentPos(datafields.at(0)->getFloat(),
155 datafields.at(1)->getFloat());
156 float yaw = datafields.at(2)->getFloat();
157 Eigen::Vector2f posError = currentPos -
target->toEigen().head(2);
158 float yawError = yaw -
target->z;
161 while (!isRunningTaskStopped())
170 out.setRemainingError(error);
180 waitForRunningTaskToFinish();