11 #include <armarx/control/memory/config/util.h>
14 #include <armarx/navigation/platform_controller/aron/PlatformLocalTrajectoryControllerConfig.aron.generated.h>
26 controllerPlugin_(controllerComponentPlugin), properties_(properties)
32 ARMARX_WARNING <<
"Dynamic loading of the controller library is deactivated (and this "
33 "is also desired). If loading the controllers is failing subsequently, "
34 "make sure that the RobotUnit's property `LoadLibraries` contains "
35 "`armarx_navigation:armarx_navigation_platform_controller`.";
53 ARMARX_INFO <<
"Initializing local trajectory controller";
64 "armarx_navigation",
"controller_config/PlatformTrajectory/default.json");
71 "controller_config/PlatformTrajectory/" + properties_.
robotName +
74 if (std::filesystem::exists(robotSpecificConfigPath.
toSystemPath()))
76 return robotSpecificConfigPath;
79 return baseConfigPath;
82 auto ctrlWrapper = builder.withNodeSet(
"PlatformPlanning")
88 localTrajCtrl_ = std::move(ctrlWrapper);
93 ARMARX_INFO <<
"Initializing global trajectory controller";
102 "controller_config/GlobalTrajectory/default.json");
104 auto ctrlWrapper = builder.withNodeSet(
"PlatformPlanning")
110 globalTrajCtrl_ = std::move(ctrlWrapper);
117 ARMARX_INFO <<
"PlatformControllerExecutor: init done.";
124 const bool activateController)
129 toAron(localTrajCtrl_->config.targets.trajectory, trajectory);
132 localTrajCtrl_->updateConfig();
134 if (activateController and not localTrajCtrl_->ctrl()->isControllerActive())
136 ARMARX_INFO <<
"Start local trajectory controller";
138 localTrajCtrl_->activate();
144 const bool activateController)
149 toAron(globalTrajCtrl_->config.targets.trajectory, trajectory);
152 << globalTrajCtrl_->config.targets.trajectory.points.size()
153 <<
" to controller.";
156 globalTrajCtrl_->updateConfig();
158 if (activateController and not globalTrajCtrl_->ctrl()->isControllerActive())
160 globalTrajCtrl_->activate();
168 switch (controllerType)
171 if (globalTrajCtrl_ and
172 not globalTrajCtrl_->ctrl()->isControllerActive())
174 globalTrajCtrl_->activate();
178 if (localTrajCtrl_ and not localTrajCtrl_->ctrl()->isControllerActive())
180 localTrajCtrl_->activate();
192 switch (controllerType)
197 if (not globalTrajCtrl_->ctrl()->isControllerActive())
200 <<
"The global trajectory controller is not active but "
201 "should be. Activating now.";
202 globalTrajCtrl_->activate();
209 if (not globalTrajCtrl_->ctrl()->isControllerActive())
212 <<
"The local trajectory controller is not active but "
213 "should be. Activating now.";
214 localTrajCtrl_->activate();
229 if (localTrajCtrl_->ctrl()->isControllerActive())
231 ARMARX_INFO <<
"Stopping local trajectory controller.";
232 localTrajCtrl_->deactivate();
236 if (globalTrajCtrl_->ctrl()->isControllerActive())
238 ARMARX_INFO <<
"Stopping global trajectory controller.";
239 globalTrajCtrl_->deactivate();
244 const auto platformUnitPrx =
248 ARMARX_INFO <<
"Stopping platform via PlatformUnit";
249 platformUnitPrx->stopPlatform();