25 #include <Eigen/Geometry>
27 #include <SimoxUtility/math/convert/mat4f_to_rpy.h>
30 #include <RobotAPI/interface/core/GeometryBase.h>
31 #include <RobotAPI/interface/core/PoseBase.h>
54 std::lock_guard<std::mutex> guard{dataMutex};
60 FrameHeader odomVelocityHeader;
61 odomVelocityHeader.parentFrame = robotRootFrame;
62 odomVelocityHeader.frame = robotRootFrame;
63 odomVelocityHeader.agent = agentName;
64 odomVelocityHeader.timestampInMicroSeconds = timestamp;
67 FrameHeader odomPoseHeader;
69 odomPoseHeader.frame = robotRootFrame;
70 odomPoseHeader.agent = agentName;
71 odomPoseHeader.timestampInMicroSeconds = timestamp;
74 FrameHeader globalPoseHeader;
76 globalPoseHeader.frame = robotRootFrame;
77 globalPoseHeader.agent = agentName;
78 globalPoseHeader.timestampInMicroSeconds = timestamp;
88 const auto odom_T_robot = VirtualRobot::MathTools::posrpy2eigen4f(
89 s->relativePositionX,
s->relativePositionY, 0, 0, 0,
s->relativePositionRotation);
116 const TransformStamped odomPose{.header = odomPoseHeader, .transform = odom_T_robot};
117 odometryPrx->reportOdometryPose(odomPose);
121 listenerPrx->reportPlatformOdometryPose(
122 odomLegacyPose.x, odomLegacyPose.y, odomLegacyPose.rotationAroundZ);
131 TwistStamped odomVelocity;
132 odomVelocity.header = odomVelocityHeader;
133 odomVelocity.twist.linear <<
s->velocityX,
s->velocityY, 0;
134 odomVelocity.twist.angular << 0, 0,
s->velocityRotation;
136 odometryPrx->reportOdometryVelocity(odomVelocity);
139 const auto& vel = odomVelocity.twist;
140 listenerPrx->reportPlatformVelocity(vel.linear.x(), vel.linear.y(), vel.angular.z());
148 if (!pt->isControllerActive())
150 pt->activateController();
152 std::lock_guard<std::mutex> guard{dataMutex};
153 pt->setVelocites(
std::clamp(vx, -maxVLin, maxVLin),
166 globalPosCtrl->setTarget(rx, ry, rr, lac, rac);
167 if (!globalPosCtrl->isControllerActive())
169 globalPosCtrl->activateController();
181 relativePosCtrl->setTarget(rx, ry, rr, lac, rac);
182 if (!relativePosCtrl->isControllerActive())
184 relativePosCtrl->activateController();
196 std::lock_guard<std::mutex> guard{dataMutex};