22#include <armarx/view_selection/gaze_targets/aron/GazeTarget.aron.generated.h>
38 template <armarx::view_selection::common::ControllerType ControllerT>
46 srv(srv), params(params)
70 auto builder = srv.controlComponentPlugin->createControllerBuilder<ControllerT>();
71 builder.withNodeSet(
"Head");
73 const std::string controllerTypeID =
80 "armarx_view_selection",
81 "controller_config/" + controllerTypeID +
"/" + params.robotName +
".json");
83 if (std::filesystem::exists(robotSpecificConfigPath.
toSystemPath()))
85 ARMARX_INFO <<
"Using robot specific config: " << robotSpecificConfigPath;
86 builder.withConfig(robotSpecificConfigPath.toSystemPath());
91 "armarx_view_selection",
92 "controller_config/" + controllerTypeID +
"/default.json");
94 ARMARX_INFO <<
"Using default config: " << defaultConfigPath;
105 auto ctrlWrapper = builder.create();
110 ctrl = std::move(ctrlWrapper);
120 ARMARX_VERBOSE <<
"Sending new target to the controller " << gazeTarget;
121 armarx::view_selection::gaze_targets::arondto::GazeTarget dto;
124 if (not ctrl->ctrl()->isControllerActive())
126 ARMARX_INFO <<
"Activating controller because it is not active yet.";
127 ctrl->ctrl()->activateController();
131 ctrl->config.target = dto;
132 ctrl->updateConfig();
137 std::unique_ptr<armarx::control::client::ControllerWrapper<ControllerT>> ctrl;
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
static std::filesystem::path toSystemPath(const data::PackagePath &pp)
~ControllerHandler() override
void updateControllerTarget(const gaze_targets::GazeTarget &gazeTarget) override
ControllerHandlerInjectedServices InjectedServices
ControllerHandlerParams Params
void createController() override
ControllerHandler(const InjectedServices &srv, const Params ¶ms)
void activateController() override
Business Object (BO) class of GazeTarget.
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_INFO
The normal logging level.
#define ARMARX_VERBOSE
The logging level for verbose information.
void toAron(arondto::PackagePath &dto, const PackageFileLocation &bo)
std::experimental::observer_ptr< armarx::control::client::ComponentPlugin > controlComponentPlugin