8#include <Eigen/Geometry>
24#include <armarx/view_selection/skills/aron/LookDirection.aron.generated.h>
35 Base(skillDescription), srv_(services), stateModFn(stateModFn)
46 LookDirection::init(
const Base::SpecializedInitInput& in)
50 const std::string frame = in.parameters.frame;
51 const std::string agent = in.parameters.agent;
54 const auto previousTarget = srv_->viewSelectionClient.readGazeTarget(
"LookDirection");
57 if (previousTarget.has_value())
59 const Eigen::Vector3f directionRead = previousTarget->position.toEigen();
64 state = stateModFn(state);
70 in.parameters.priority};
72 const gaze_targets::GazeTarget target{
73 "LookDirection", targetPos, priority, duration,
false};
74 gazeTarget.emplace(target);
76 return ::armarx::skills::Skill::InitResult{
80 ::armarx::skills::Skill::MainResult
81 LookDirection::main(
const Base::SpecializedMainInput& in)
87 in.parameters.waitUntilReached,
88 in.parameters.waitTimeout_ms,
89 [
this]() { return shouldSkillTerminate(); });
93 LookDirection::onStopRequested()
95 if (gazeTarget.has_value())
97 srv_->viewSelectionClient.commitGazeTarget(gazeTarget.value());
101 armarx::skills::SkillDescription
105 defaultParameters.frame =
"root";
106 defaultParameters.agent =
"Armar7";
107 defaultParameters.priority = 1;
110 .description =
"Let the robot look " + directionText +
111 ". Multiple directions can be combined but stacking the same direction "
112 "does not move the head further.",
113 .rootProfileDefaults = defaultParameters.toAron(),
115 .parametersType = Params::ToAronType(),
228 float epsilon = 10.0;
258 return targetPosition;
The FramedPosition class.
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
arondto::LookDirectionParams ParamType
static armarx::skills::SkillDescription DefaultSkillDescription()
LookAhead(const Context &services)
::armarx::skills::SimpleSpecializedSkill< Params > Base
static armarx::skills::SkillDescription generateDefaultSkillDescription(std::string name, std::string directionText)
LookDirection(const Context &services, direction::state::StateModFn *stateModFn, armarx::skills::SkillDescription skillDescription)
void connect(const Context &srv)
LookDown(const Context &services)
static armarx::skills::SkillDescription DefaultSkillDescription()
static armarx::skills::SkillDescription DefaultSkillDescription()
LookDownstraight(const Context &services)
LookLeft(const Context &services)
static armarx::skills::SkillDescription DefaultSkillDescription()
LookRight(const Context &services)
static armarx::skills::SkillDescription DefaultSkillDescription()
LookUp(const Context &services)
static armarx::skills::SkillDescription DefaultSkillDescription()
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_INFO
The normal logging level.
@ TaskDriven
Task-Driven attention has highest priority.
const std::string LookDownstraight
const std::string LookDown
const std::string LookRight
const std::string LookAhead
const std::string LookLeft
The namespace state contains the states of allowed directions.
state::Type(state::Type) StateModFn
state::Type downstraight(state::Type previous)
state::Type right(state::Type previous)
Eigen::Vector3f generateTargetPosition(state::Type state)
state::Type up(state::Type previous)
state::Type left(state::Type previous)
constexpr std::uint8_t Left
constexpr std::uint8_t Right
state::Type center(state::Type previous)
state::Type down(state::Type previous)
constexpr std::uint8_t Downstraight
constexpr std::uint8_t Center
constexpr std::uint8_t Down
state::Type from(Eigen::Vector3f targetPosition)
constexpr std::uint8_t Up
const Eigen::Vector3f deltaRight
const Eigen::Vector3f deltaLeft
const Eigen::Vector3f downstraightPosition
const Eigen::Vector3f deltaDown
const Eigen::Vector3f centerPosition
const Eigen::Vector3f DeltaUp
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.
This file offers overloads of toIce() and fromIce() functions for STL container types.
This file is part of ArmarX.
A result struct for skill initialization.