ResetGazeTargets.cpp
Go to the documentation of this file.
1#include "ResetGazeTargets.h"
2
3#include <Eigen/Core>
4#include <Eigen/Geometry>
5
10
15
19
21{
22
24 Base(DefaultSkillDescription()), srv_(services)
25 {
26 ARMARX_CHECK_NOT_NULL(srv_->viewSelectionClient);
27 }
28
29 // ::armarx::skills::Skill::InitResult
30 // ResetGazeTargets::init(const Base::InitInput& in)
31 // {
32 // return ::armarx::skills::Skill::InitResult{
33 // .status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
34 // }
35
36 // ::armarx::skills::Skill::MainResult
37 // ResetGazeTargets::main(const Base::MainInput& in)
38 // {
39 // ARMARX_INFO << "Resetting all gaze targets";
40 // ARMARX_CHECK_NOT_NULL(srv_->viewSelectionClient);
41 // srv_->viewSelectionClient->resetPriorityQueue();
42
43 // return ::armarx::skills::Skill::MainResult{
44 // .status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
45 // }
46
48 ResetGazeTargets::init(const Base::SpecializedInitInput& /*in*/)
49 {
50 return ::armarx::skills::Skill::InitResult{
52 }
53
55 ResetGazeTargets::main(const Base::SpecializedMainInput& /*in*/)
56 {
57 ARMARX_INFO << "Look ahead first, this fixes a bug.";
58 // For example, if you:
59 // 1) look right (robot will look right)
60 // 2) reset gaze targets (robot will look ahead)
61 // 3) look down
62 // then the robot will not look down as expected without this fix, but instead will look
63 // down/right since the last state is still fetched from memory. Calling look ahead before
64 // resetting sets the center position again as last location for relative head movement
65 // commands.
67
69
70 ARMARX_INFO << "Resetting all gaze targets";
71 ARMARX_CHECK_NOT_NULL(srv_->viewSelectionClient);
72 srv_->viewSelectionClient->resetPriorityQueue();
73
74 return ::armarx::skills::Skill::MainResult{
76 }
77
78 void
79 ResetGazeTargets::onStopRequested()
80 {
81 ;
82 }
83
84 ::armarx::skills::SkillDescription
86 {
87 Params defaults;
88
91 .description = "",
92 .rootProfileDefaults = defaults.toAron(),
94 .parametersType = Params::ToAronType(),
95 };
96 }
97
98} // namespace armarx::view_selection::skills
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
Definition Clock.cpp:99
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition Duration.cpp:72
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId)
Call a subskill with the given ID and its default parameters.
Definition Skill.cpp:119
::armarx::skills::SimpleSpecializedSkill< Params > Base
static armarx::skills::SkillDescription DefaultSkillDescription()
#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.
Definition Logging.h:181
const armarx::skills::SkillID LookAhead
Definition skill_ids.cpp:85
const armarx::skills::SkillID ResetGazeTargets
Definition skill_ids.cpp:94
This file is part of ArmarX.
Definition constants.cpp:26
A result struct for skill initialization.
Definition Skill.h:50
A result struct for th main method of a skill.
Definition Skill.h:62