LookAtHumanFace.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/skills/provider/SimpleSkill.h
>
28
#include <
RobotAPI/libraries/skills/provider/SimpleSpecializedSkill.h
>
29
30
#include <
armarx/view_selection/client/ViewSelection.h
>
31
#include <armarx/view_selection/skills/aron/LookAtHumanFace.aron.generated.h>
32
#include <
armarx/view_selection/skills/constants.h
>
33
#include <
armarx/view_selection/target_provider/handover/RobotReceiver.h
>
34
35
#include <
VisionX/libraries/armem_human/client/HumanPoseReader.h
>
36
37
namespace
armarx::view_selection::skills
38
{
39
class
LookAtHumanFace
:
40
virtual
public
armarx::skills::SimpleSpecializedSkill
<arondto::LookAtHumanFaceParams>
41
{
42
public
:
43
using
Params
= arondto::LookAtHumanFaceParams;
44
using
Base
=
::armarx::skills::SimpleSpecializedSkill<Params>
;
45
46
struct
Services
47
{
48
armem::client::MemoryNameSystem
&
memoryNameSystem
;
49
client::ViewSelection
&
viewSelectionClient
;
50
const
armarx::armem::MemoryID
humanPoseMemoryID
;
51
const
VirtualRobot::RobotPtr
&
robot
;
52
};
53
54
LookAtHumanFace
(
const
Services
& srv);
// FIXME add Properties
55
56
private
:
57
::armarx::skills::Skill::InitResult
init
(
const
Base::SpecializedInitInput
& in)
override
;
58
59
::armarx::skills::Skill::MainResult
main
(
const
Base::SpecializedMainInput
& in)
override
;
60
61
void
update();
62
std::optional<armem::human::HumanPose> getLatestPoseOfRequestedHuman();
63
64
void
onStopRequested()
override
;
65
66
67
public
:
68
static
armarx::skills::SkillDescription
69
DefaultSkillDescription
()
70
{
71
ParamType
defaultParameters;
72
// TODO(): set parameter defaults
73
74
return
armarx::skills::SkillDescription
{
75
.
skillId
= {.
skillName
=
constants::skill_names::LookAtHumanFace
},
76
.description =
"Look at the face of a human specified by their tracking ID."
,
77
.rootProfileDefaults = defaultParameters.toAron(),
78
.timeout =
armarx::core::time::Duration::Seconds
(10),
79
.parametersType = Params::ToAronType()};
80
}
81
82
protected
:
83
private
:
84
std::optional<Services> srv_;
85
86
std::string humanTrackingId;
87
std::unique_ptr<target_provider::handover::RobotReceiver> handoverTargetProvider;
88
89
struct
Properties
90
{
91
double
updatePeriodMs = 1000. / 30.;
92
} properties;
93
94
bool
stop_requested_ =
false
;
95
};
96
97
}
// namespace armarx::view_selection::skills
armarx::view_selection::skills
This file is part of ArmarX.
Definition:
constants.cpp:25
armarx::skills::SimpleSpecializedSkill< arondto::LookAtHumanFaceParams >::init
Skill::InitResult init() final
Definition:
SimpleSpecializedSkill.h:62
armarx::skills::SimpleSpecializedSkill< arondto::LookAtHumanFaceParams >::ParamType
arondto::LookAtHumanFaceParams ParamType
Definition:
SimpleSpecializedSkill.h:14
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:41
armarx::view_selection::skills::LookAtHumanFace::Services::humanPoseMemoryID
const armarx::armem::MemoryID humanPoseMemoryID
Definition:
LookAtHumanFace.h:50
armarx::skills::SkillDescription
Definition:
SkillDescription.h:17
Duration.h
armarx::view_selection::skills::LookAtHumanFace
Definition:
LookAtHumanFace.h:39
armarx::view_selection::client::ViewSelection
Definition:
ViewSelection.h:37
SimpleSpecializedSkill.h
armarx::skills::SimpleSpecializedSkill::SpecializedMainInput
Definition:
SimpleSpecializedSkill.h:24
armarx::core::time::Duration::Seconds
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition:
Duration.cpp:72
armarx::armem::MemoryID
A memory ID.
Definition:
MemoryID.h:47
ManagedIceObject.h
RobotReceiver.h
ViewSelection.h
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:19
armarx::skills::SimpleSpecializedSkill
Definition:
SimpleSpecializedSkill.h:10
armarx::view_selection::skills::LookAtHumanFace::Params
arondto::LookAtHumanFaceParams Params
Definition:
LookAtHumanFace.h:43
armarx::view_selection::skills::constants::skill_names::LookAtHumanFace
const std::string LookAtHumanFace
Definition:
constants.cpp:38
armarx::view_selection::skills::LookAtHumanFace::DefaultSkillDescription
static armarx::skills::SkillDescription DefaultSkillDescription()
Definition:
LookAtHumanFace.h:69
constants.h
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition:
Skill.h:39
SimpleSkill.h
HumanPoseReader.h
armarx::skills::SimpleSpecializedSkill::SpecializedInitInput
Definition:
SimpleSpecializedSkill.h:18
armarx::skills::SimpleSpecializedSkill< arondto::LookAtHumanFaceParams >::main
Skill::MainResult main() final
Definition:
SimpleSpecializedSkill.h:71
armarx::view_selection::skills::LookAtHumanFace::Services::robot
const VirtualRobot::RobotPtr & robot
Definition:
LookAtHumanFace.h:51
armarx::view_selection::skills::LookAtHumanFace::Services
Definition:
LookAtHumanFace.h:46
armarx::skills::Skill::InitResult
A result struct for skill initialization.
Definition:
Skill.h:27
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition:
MemoryNameSystem.h:73
armarx::view_selection::skills::LookAtHumanFace::LookAtHumanFace
LookAtHumanFace(const Services &srv)
Definition:
LookAtHumanFace.cpp:12
armarx::view_selection::skills::LookAtHumanFace::Services::viewSelectionClient
client::ViewSelection & viewSelectionClient
Definition:
LookAtHumanFace.h:49
armarx::view_selection::skills::LookAtHumanFace::Services::memoryNameSystem
armem::client::MemoryNameSystem & memoryNameSystem
Definition:
LookAtHumanFace.h:48
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition:
Bus.h:19
armarx
view_selection
skills
LookAtHumanFace.h
Generated by
1.8.17