7#include <Eigen/Geometry>
41 SetCustomGazeTarget::init(
const Base::SpecializedInitInput& in)
44 std::string frame = in.parameters.frame;
45 std::string agent = in.parameters.agent;
47 Eigen::Vector3f{in.parameters.x, in.parameters.y, in.parameters.z}, frame, agent};
49 in.parameters.priority};
52 gaze_targets::GazeTarget target{
53 in.parameters.gazeTargetName, targetPos, priority, duration,
false};
54 gazeTarget.emplace(target);
58 return ::armarx::skills::Skill::InitResult{
62 ::armarx::skills::Skill::MainResult
63 SetCustomGazeTarget::main(
const Base::SpecializedMainInput& in)
69 in.parameters.waitUntilFinished,
70 in.parameters.waitTimeout_ms,
71 [
this]() { return shouldSkillTerminate(); });
75 SetCustomGazeTarget::onStopRequested()
77 if (gazeTarget.has_value())
79 srv_->viewSelectionClient.commitGazeTarget(gazeTarget.value());
83 armarx::skills::SkillDescription
87 defaultParameters.frame =
"root";
88 defaultParameters.agent =
"Armar7";
89 defaultParameters.gazeTargetName =
"SetCustomGazeTarget";
90 defaultParameters.priority = 1;
91 defaultParameters.duration_ms = 1000;
92 defaultParameters.x = 0;
93 defaultParameters.y = 1500;
94 defaultParameters.z = 1500;
97 defaultParameters.waitUntilFinished =
false;
100 defaultParameters.waitTimeout_ms = 10000;
104 .description =
"Set a gaze target by coordinate, agent and frame. Supported frames "
105 "include the Global frame and the robot root frames. With "
106 "waitUntilFinished, the skill blocks until the robot's gaze is fixed on "
107 "the target and fails if it never gets there.",
108 .rootProfileDefaults = defaultParameters.toAron(),
112 .parametersType = Params::ToAronType(),
The FramedPosition class.
static Duration Hours(std::int64_t hours)
Constructs a duration in hours.
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
arondto::SetCustomGazeTargetParams ParamType
::armarx::skills::SimpleSpecializedSkill< Params > Base
static armarx::skills::SkillDescription DefaultSkillDescription()
SetCustomGazeTarget(const Context &services)
void connect(const Context &srv)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
@ TaskDriven
Task-Driven attention has highest priority.
const std::string SetCustomGazeTarget
This file is part of ArmarX.
::armarx::skills::Skill::MainResult commitAndMaybeWait(client::ViewSelection &viewSelection, const gaze_targets::GazeTarget &target, const bool waitUntilReached, const std::int64_t waitTimeout_ms, const std::function< bool()> &shouldAbort)
Commit a gaze target, optionally blocking until the robot's gaze is fixed on it.
A result struct for skill initialization.