CloseHand.cpp
Go to the documentation of this file.
1 #include "CloseHand.h"
2 
3 #include "util/HandUtil.h"
4 
5 namespace armarx::skills
6 {
7 
8  SkillDescription CloseHand::Description = skills::SkillDescription{
9  "CloseHand", "Close a hand",
11  hand_control::arondto::CloseHandAcceptedType::ToAronType()
12  };
13 
15  HandControlSkill(context),
16  SimpleSpecializedSkill<ArgType>(Description)
17  {
18  }
19 
20  Skill::MainResult CloseHand::main(const SpecializedMainInput& in)
21  {
22  if (simox::alg::starts_with(in.parameters.kinematicChainName, "Left"))
23  {
24  closeLeftHand();
25  return {TerminatedSkillStatus::Succeeded, nullptr};
26  }
27 
28  if (simox::alg::starts_with(in.parameters.kinematicChainName, "Right"))
29  {
31  return {TerminatedSkillStatus::Succeeded, nullptr};
32  }
33 
34  return {TerminatedSkillStatus::Failed, nullptr};
35  }
36 }
armarx::skills::CloseHand::Description
static SkillDescription Description
Definition: CloseHand.h:46
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
armarx::skills::CloseHand::ArgType
hand_control::arondto::CloseHandAcceptedType ArgType
Definition: CloseHand.h:38
armarx::skills
This file is part of ArmarX.
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::CloseHand::CloseHand
CloseHand(HandControlSkillContext &context)
Definition: CloseHand.cpp:14
armarx::starts_with
bool starts_with(const std::string &haystack, const std::string &needle)
Definition: StringHelpers.cpp:43
armarx::skills::SimpleSpecializedSkill
Definition: SimpleSpecializedSkill.h:10
armarx::skills::HandControlSkill
Definition: HandControlSkill.h:57
armarx::skills::HandControlSkill::closeRightHand
void closeRightHand()
Definition: HandControlSkill.h:78
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition: Skill.h:48
armarx::skills::HandControlSkillContext
Definition: HandControlSkill.h:44
armarx::skills::TerminatedSkillStatus::Failed
@ Failed
armarx::skills::SimpleSpecializedSkill< hand_control::arondto::CloseHandAcceptedType >::main
Skill::MainResult main() final
Definition: SimpleSpecializedSkill.h:71
CloseHand.h
armarx::skills::HandControlSkill::closeLeftHand
void closeLeftHand()
Definition: HandControlSkill.h:66
HandUtil.h
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition: Duration.cpp:55