6 #include <ArmarXCore/interface/serialization/Eigen/Eigen_fdi.h>
13 #include <armarx/navigation/platform_controller/aron/PlatformLocalTrajectoryControllerConfig.aron.generated.h>
18 const NJointControllerRegistration<Controller>
Registration(
22 const NJointControllerConfigPtr& config,
29 ConfigPtrT cfg = ConfigPtrT::dynamicCast(config);
38 ControlModes::HolonomicPlatformVelocity)
41 <<
"The actuator " << robotUnit->getRobotPlatformName() <<
" has no control mode "
42 << ControlModes::HolonomicPlatformVelocity;
44 const auto configData = ::armarx::fromAron<arondto::Config, Config>(cfg->config);
45 const auto trajectoryFollowingControllerParams = configData.params;
51 trajectoryFollowingController.emplace(trajectoryFollowingControllerParams);
75 robotStateBuffer_rtToAdditionalTask.
getWriteBuffer().global_T_robot.matrix() =
82 const Ice::Current& iceCurrent)
88 const auto updateConfig = ::armarx::fromAron<arondto::Config, Config>(dto);
91 configBuffer_updateConfigToAdditionalTask.
commitWrite();
104 ARMARX_CHECK(trajectoryFollowingController.has_value());
106 const auto& configBuffer =
110 if (configBuffer.targets.trajectory.points().empty())
114 filteredTwist.
reset();
122 const auto result = trajectoryFollowingController->control(
123 configBuffer.targets.trajectory,
128 const float alpha = configBuffer.params.alpha;
130 alpha * filteredTwist.
linear + (1. - alpha) * result.twist.linear.head<2>();
132 alpha * filteredTwist.
angular + (1. - alpha) * result.twist.angular.z();
140 targetBuffer_additionalTaskToOnPublish.
getWriteBuffer() = filteredTwist;
141 targetBuffer_additionalTaskToOnPublish.
commitWrite();
153 datafields[
"vx"] =
new Variant(targets.linear.x());
154 datafields[
"vy"] =
new Variant(targets.linear.y());
155 datafields[
"vyaw"] =
new Variant(targets.angular);
156 datafields[
"trajectory_points"] =
158 .targets.trajectory.points()
161 debugObservers->setDebugChannel(
169 runTask(
"PlatformTrajectoryControllerAdditionalTask",
174 ARMARX_IMPORTANT <<
"Create a new thread alone PlatformTrajectory controller";
175 while (
getState() == eManagedIceObjectStarted)
182 c.waitForCycleDuration();
186 ARMARX_INFO <<
"PlatformTrajectoryVelocityController::onInitNJointController";
193 filteredTwist.
reset();
195 robotStateBuffer_rtToAdditionalTask.
getWriteBuffer().global_T_robot.matrix() =
205 rtReady.store(
false);