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