HandControlSkill.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 2021
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#pragma once
23
24
// STD/STL
25
#include <string>
26
27
// ArmarX
28
#include <
ArmarXCore/core/Component.h
>
29
30
// RobotAPI
31
#include <
RobotAPI/libraries/skills/provider/SimpleSpecializedSkill.h
>
32
#include <
RobotAPI/libraries/skills/provider/SkillContext.h
>
33
34
// Proxies
35
#include <RobotAPI/interface/units/HandUnitInterface.h>
36
37
// ArmarX
38
#include <
ArmarXCore/core/Component.h
>
39
40
#include <
RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h
>
41
#include <
RobotAPI/libraries/armem/client/MemoryNameSystem.h
>
42
43
namespace
armarx::skills
44
{
45
struct
HandControlSkillContext
:
public
SkillContext
46
{
47
// Properties
48
HandUnitInterfacePrx
leftHandUnitPrx
;
49
HandUnitInterfacePrx
rightHandUnitPrx
;
50
51
void
52
defineProperties
(
const
armarx::PropertyDefinitionsPtr
& defs,
53
const
std::string& prefix)
final
54
{
55
defs->component(
56
leftHandUnitPrx
,
"LeftHandUnitName"
, prefix +
"LeftHandUnitInterfaceName"
);
57
defs->component(
58
rightHandUnitPrx
,
"RightHandUnitName"
, prefix +
"RightHandUnitInterfaceName"
);
59
}
60
};
61
62
class
HandControlSkill
63
{
64
public
:
65
HandControlSkill
(
HandControlSkillContext
&
c
) :
context
(
c
){};
66
67
protected
:
68
void
69
closeLeftHand
()
70
{
71
context
.
leftHandUnitPrx
->setShape(
"Close Preshape"
);
72
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
73
}
74
75
void
76
openLeftHand
()
77
{
78
context
.
leftHandUnitPrx
->setShape(
"Open Preshape"
);
79
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
80
}
81
82
void
83
closeRightHand
()
84
{
85
context
.
rightHandUnitPrx
->setShape(
"Close Preshape"
);
86
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
87
}
88
89
void
90
openRightHand
()
91
{
92
context
.
rightHandUnitPrx
->setShape(
"Open Preshape"
);
93
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
94
}
95
96
protected
:
97
HandControlSkillContext
&
context
;
98
};
99
}
// namespace armarx::skills
ArVizComponentPlugin.h
armarx::skills
This file is part of ArmarX.
Definition:
PeriodicUpdateWidget.cpp:11
armarx::skills::HandControlSkill::openLeftHand
void openLeftHand()
Definition:
HandControlSkill.h:76
armarx::skills::HandControlSkill::openRightHand
void openRightHand()
Definition:
HandControlSkill.h:90
c
constexpr T c
Definition:
UnscentedKalmanFilterTest.cpp:46
SimpleSpecializedSkill.h
armarx::skills::HandControlSkillContext::leftHandUnitPrx
HandUnitInterfacePrx leftHandUnitPrx
Definition:
HandControlSkill.h:48
armarx::skills::SkillContext
Definition:
SkillContext.h:13
armarx::skills::HandControlSkill
Definition:
HandControlSkill.h:62
armarx::skills::HandControlSkill::closeRightHand
void closeRightHand()
Definition:
HandControlSkill.h:83
Component.h
armarx::skills::HandControlSkillContext::rightHandUnitPrx
HandUnitInterfacePrx rightHandUnitPrx
Definition:
HandControlSkill.h:49
SkillContext.h
armarx::skills::HandControlSkillContext
Definition:
HandControlSkill.h:45
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::skills::HandControlSkill::closeLeftHand
void closeLeftHand()
Definition:
HandControlSkill.h:69
MemoryNameSystem.h
armarx::skills::HandControlSkill::context
HandControlSkillContext & context
Definition:
HandControlSkill.h:97
armarx::skills::HandControlSkillContext::defineProperties
void defineProperties(const armarx::PropertyDefinitionsPtr &defs, const std::string &prefix) final
Definition:
HandControlSkill.h:52
armarx::skills::HandControlSkill::HandControlSkill
HandControlSkill(HandControlSkillContext &c)
Definition:
HandControlSkill.h:65
RobotSkillTemplates
libraries
skill_hand_control
HandControlSkill.h
Generated by
1.8.17