13 #include <armarx/navigation/platform_controller/aron/PlatformGlobalTrajectoryControllerConfig.aron.generated.h>
18 const NJointControllerRegistration<Controller>
Registration(
22 const NJointControllerConfigPtr& config,
29 ConfigPtrT cfg = ConfigPtrT::dynamicCast(config);
39 const std::string controlTargetName = robotUnit->getRobotPlatformName();
41 ARMARX_INFO <<
"Using control target " << controlTargetName;
43 ControlModes::HolonomicPlatformVelocity);
49 <<
"The actuator " << controlTargetName <<
" has no control mode "
50 << ControlModes::HolonomicPlatformVelocity;
54 const auto configData = ::armarx::fromAron<arondto::Config, Config>(cfg->config);
55 const auto trajectoryFollowingControllerParams = configData.params;
61 trajectoryFollowingController.emplace(trajectoryFollowingControllerParams);
85 robotStateBuffer_rtToAdditionalTask.
getWriteBuffer().global_T_robot.matrix() =
92 const Ice::Current& iceCurrent)
98 const auto updateConfig = ::armarx::fromAron<arondto::Config, Config>(dto);
101 configBuffer_updateConfigToAdditionalTask.
commitWrite();
104 configBuffer_updateConfigToOnPublish.
commitWrite();
115 ARMARX_CHECK(trajectoryFollowingController.has_value());
117 const auto& configBuffer =
122 if (configBuffer.targets.trajectory.points().empty())
126 filteredTwist.
reset();
137 trajectoryFollowingController->control(
138 configBuffer.targets.trajectory,
143 const float alpha = configBuffer.params.alpha;
156 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().target = filteredTwist;
157 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().dropPointVelocity =
159 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().currentOrientation =
161 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().desiredOrientation =
163 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().orientationError =
165 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().positionError =
167 targetBuffer_additionalTaskToOnPublish.getWriteBuffer().isFinalSegment =
169 targetBuffer_additionalTaskToOnPublish.commitWrite();
179 const auto& debugStuff = targetBuffer_additionalTaskToOnPublish.getUpToDateReadBuffer();
182 datafields[
"vx"] =
new Variant(debugStuff.target.linear.x());
183 datafields[
"vy"] =
new Variant(debugStuff.target.linear.y());
184 datafields[
"vyaw"] =
new Variant(debugStuff.target.angular);
185 datafields[
"trajectory_points"] =
187 .targets.trajectory.points()
190 datafields[
"drop_point_velocity"] =
new Variant(debugStuff.dropPointVelocity);
192 datafields[
"orientationError"] =
new Variant(debugStuff.orientationError);
193 datafields[
"desiredOrientation"] =
new Variant(debugStuff.desiredOrientation);
194 datafields[
"currentOrientation"] =
new Variant(debugStuff.currentOrientation);
195 datafields[
"isFinalSegment"] =
new Variant(debugStuff.isFinalSegment);
197 datafields[
"positionError"] =
new Variant(debugStuff.positionError);
199 debugObservers->setDebugChannel(
208 ARMARX_INFO <<
"PlatformGlobalTrajectoryController::onInitNJointController";
210 runTask(
"PlatformGlobalTrajectoryControllerAdditionalTask",
215 ARMARX_IMPORTANT <<
"Create a new thread alone PlatformGlobalTrajectoryController controller";
216 while (
getState() == eManagedIceObjectStarted)
223 c.waitForCycleDuration();
227 ARMARX_INFO <<
"PlatformGlobalTrajectoryController::onInitNJointController done.";
236 filteredTwist.
reset();
238 robotStateBuffer_rtToAdditionalTask.
getWriteBuffer().global_T_robot.matrix() =
248 rtReady.store(
false);