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()};
58 MovePlatformToPose::step(
const SpecializedMainInput& in)
64 auto a = armarx::viz::Sphere(
"MovePlatformToPose::targetPose");
65 a.pose(in.parameters.pose);
67 a.color(viz::Color::yellow());
73 robotReader.getSynchronizedRobot(in.parameters.robotName,
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);
90 Eigen::Matrix3f targetRotMat = in.parameters.pose.block<3, 3>(0, 0);
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);
101 Eigen::Matrix3f robotRotMat = robotPoseGlobalEigen.block<3, 3>(0, 0);
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 <<
")";
141 context.platformUnitPrx->moveTo(targetX,
144 in.parameters.positionalAccuracy * 0.8,
145 in.parameters.orientationalAccuracy * 0.8);
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
The memory name system (MNS) client.
virtual void connect(armem::client::MemoryNameSystem &memoryNameSystem)
virtual InitResult init()
Override this method with the actual implementation.
virtual ExitResult exit()
Override this method with the actual implementation.
#define ARMARX_INFO
The normal logging level.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
const VariantTypeId FramedPose
double a(double t, double a0, double j)
This file is part of ArmarX.
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< FramedPose > FramedPosePtr
double norm(const Point &a)
A result struct for skill initialization.
armarx::viz::Client arviz
armem::client::MemoryNameSystem mns
armem::robot_state::VirtualRobotReader robotReader