LookAtHumanHand.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @author Fabian Reister ( fabian dot reister at kit dot edu )
17
* @date 2023
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#pragma once
23
24
#include <
ArmarXCore/core/ManagedIceObject.h
>
25
#include <
ArmarXCore/core/time/Duration.h
>
26
27
#include <
RobotAPI/libraries/armem_robot_state/client/common/RobotReader.h
>
// for hand
28
#include <
RobotAPI/libraries/skills/provider/SimpleSkill.h
>
29
#include <
RobotAPI/libraries/skills/provider/SimpleSpecializedSkill.h
>
30
31
#include <
armarx/view_selection/client/ViewSelection.h
>
32
#include <armarx/view_selection/skills/aron/LookAtHumanHand.aron.generated.h>
33
#include <
armarx/view_selection/skills/constants.h
>
34
#include <
armarx/view_selection/target_provider/handover/RobotReceiver.h
>
35
36
#include <
VisionX/libraries/armem_human/client/HumanPoseReader.h
>
37
38
namespace
armarx::view_selection::skills
39
{
40
class
LookAtHumanHand
:
41
virtual
public
armarx::skills::SimpleSpecializedSkill
<arondto::LookAtHumanHandParams>
42
{
43
public
:
44
using
Params
= arondto::LookAtHumanHandParams;
45
using
Base
=
::armarx::skills::SimpleSpecializedSkill<Params>
;
46
47
struct
Services
48
{
49
armem::client::MemoryNameSystem
&
memoryNameSystem
;
50
client::ViewSelection
&
viewSelectionClient
;
51
const
armarx::armem::MemoryID
humanPoseMemoryID
;
52
const
VirtualRobot::RobotPtr
&
robot
;
53
};
54
55
LookAtHumanHand
(
const
Services
& srv);
// FIXME add params
56
57
private
:
58
using
Base::init
;
59
::armarx::skills::Skill::InitResult
init(
const
Base::SpecializedInitInput& in)
override
;
60
61
using
Base::main
;
62
::armarx::skills::Skill::MainResult
main(
const
Base::SpecializedMainInput& in)
override
;
63
64
void
update();
65
std::optional<armem::human::HumanPose> getLatestPoseOfRequestedHuman();
66
67
void
onStopRequested()
override
;
68
69
public
:
70
static
armarx::skills::SkillDescription
71
DefaultSkillDescription
()
72
{
73
ParamType
defaultParameters;
74
// TODO(): set parameter defaults
75
76
return
armarx::skills::SkillDescription
{
77
.skillId = {.skillName =
constants::skill_names::LookAtHumanHand
},
78
.description =
"Look at the face of a human specified by their tracking ID."
,
79
.rootProfileDefaults = defaultParameters.toAron(),
80
.timeout =
armarx::core::time::Duration::Seconds
(10),
81
.parametersType = Params::ToAronType()};
82
}
83
84
protected
:
85
private
:
86
std::optional<Services> srv_;
87
88
std::string humanTrackingId;
89
armarx::armem::robot_state::RobotReader::Hand
hand;
90
std::unique_ptr<target_provider::handover::RobotReceiver> handoverTargetProvider;
91
92
struct
93
{
94
double
updatePeriodMs
= 1000. / 30.;
95
} properties;
96
};
97
98
}
// namespace armarx::view_selection::skills
Duration.h
HumanPoseReader.h
ManagedIceObject.h
RobotReader.h
RobotReceiver.h
SimpleSkill.h
SimpleSpecializedSkill.h
armarx::armem::MemoryID
A memory ID.
Definition
MemoryID.h:48
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition
MemoryNameSystem.h:74
armarx::armem::robot_state::RobotReader::Hand
Hand
Definition
RobotReader.h:92
armarx::core::time::Duration::Seconds
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition
Duration.cpp:72
armarx::skills::SimpleSpecializedSkill
Definition
SimpleSpecializedSkill.h:19
armarx::skills::SimpleSpecializedSkill< arondto::LookAtHumanHandParams >::ParamType
arondto::LookAtHumanHandParams ParamType
Definition
SimpleSpecializedSkill.h:22
armarx::skills::SimpleSpecializedSkill< Params >::main
virtual Skill::MainResult main(const SpecializedMainInput &)
Definition
SimpleSpecializedSkill.h:54
armarx::skills::SimpleSpecializedSkill< Params >::init
virtual Skill::InitResult init(const SpecializedInitInput &)
Definition
SimpleSpecializedSkill.h:48
armarx::view_selection::client::ViewSelection
Definition
ViewSelection.h:24
armarx::view_selection::skills::LookAtHumanHand::LookAtHumanHand
LookAtHumanHand(const Services &srv)
Definition
LookAtHumanHand.cpp:10
armarx::view_selection::skills::LookAtHumanHand::Base
::armarx::skills::SimpleSpecializedSkill< Params > Base
Definition
LookAtHumanHand.h:45
armarx::view_selection::skills::LookAtHumanHand::updatePeriodMs
double updatePeriodMs
Definition
LookAtHumanHand.h:94
armarx::view_selection::skills::LookAtHumanHand::Params
arondto::LookAtHumanHandParams Params
Definition
LookAtHumanHand.h:44
armarx::view_selection::skills::LookAtHumanHand::DefaultSkillDescription
static armarx::skills::SkillDescription DefaultSkillDescription()
Definition
LookAtHumanHand.h:71
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition
Bus.h:19
armarx::view_selection::skills::constants::skill_names::LookAtHumanHand
const std::string LookAtHumanHand
Definition
constants.cpp:37
armarx::view_selection::skills
This file is part of ArmarX.
Definition
constants.cpp:26
ViewSelection.h
constants.h
armarx::skills::SkillDescription
Definition
SkillDescription.h:18
armarx::skills::Skill::InitResult
A result struct for skill initialization.
Definition
Skill.h:50
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition
Skill.h:62
armarx::view_selection::skills::LookAtHumanHand::Services
Definition
LookAtHumanHand.h:48
armarx::view_selection::skills::LookAtHumanHand::Services::memoryNameSystem
armem::client::MemoryNameSystem & memoryNameSystem
Definition
LookAtHumanHand.h:49
armarx::view_selection::skills::LookAtHumanHand::Services::humanPoseMemoryID
const armarx::armem::MemoryID humanPoseMemoryID
Definition
LookAtHumanHand.h:51
armarx::view_selection::skills::LookAtHumanHand::Services::robot
const VirtualRobot::RobotPtr & robot
Definition
LookAtHumanHand.h:52
armarx::view_selection::skills::LookAtHumanHand::Services::viewSelectionClient
client::ViewSelection & viewSelectionClient
Definition
LookAtHumanHand.h:50
armarx
view_selection
skills
LookAtHumanHand.h
Generated by
1.13.2