8#include <Eigen/Geometry>
24#include <armarx/view_selection/skills/aron/LookDirection.aron.generated.h>
34 Base(skillDescription), srv_(services), stateModFn(stateModFn)
45 LookDirection::init(
const Base::SpecializedInitInput& in)
49 const std::string frame = in.parameters.frame;
50 const std::string agent = in.parameters.agent;
53 const auto previousTarget = srv_->viewSelectionClient.readGazeTarget(
"LookDirection");
56 if (previousTarget.has_value())
58 const Eigen::Vector3f directionRead = previousTarget->position.toEigen();
63 state = stateModFn(state);
69 in.parameters.priority};
71 const gaze_targets::GazeTarget target{
72 "LookDirection", targetPos, priority, duration,
false};
73 gazeTarget.emplace(target);
75 return ::armarx::skills::Skill::InitResult{
79 ::armarx::skills::Skill::MainResult
80 LookDirection::main(
const Base::SpecializedMainInput& in)
84 ARMARX_INFO <<
"Committing gaze target " << gazeTarget.value();
85 srv_->viewSelectionClient.commitGazeTarget(gazeTarget.value());
87 return ::armarx::skills::Skill::MainResult{
92 LookDirection::onStopRequested()
94 if (gazeTarget.has_value())
96 srv_->viewSelectionClient.commitGazeTarget(gazeTarget.value());
100 armarx::skills::SkillDescription
104 defaultParameters.frame =
"root";
105 defaultParameters.agent =
"Armar7";
106 defaultParameters.priority = 1;
109 .description =
"Let the robot look " + directionText +
110 ". Multiple directions can be combined but stacking the same direction "
111 "does not move the head further.",
112 .rootProfileDefaults = defaultParameters.toAron(),
114 .parametersType = Params::ToAronType(),
227 float epsilon = 10.0;
257 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.
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.