BringObjectToLocation.cpp
Go to the documentation of this file.
2 
3 #include <RobotAPI/libraries/skills/provider/SkillProxy.h>
4 
5 #include <RobotSkillTemplates/libraries/skill_bring_object/aron/BringObjectToLandmarkAcceptedType.aron.generated.h>
6 
7 namespace armarx::skills
8 {
9  namespace
10  {
11  arondto::BringObjectToLandmarkAcceptedType GetDefaultParameterization()
12  {
13  arondto::BringObjectToLandmarkAcceptedType ret;
14  ret.robotName = "Armar3";
15  ret.graph = "KitchenKK";
16  ret.objectEntityId = "Kitchen/green-cup/0";
17  ret.landmarkFrom = "sideboard";
18  ret.landmarkTo = "sink";
19  return ret;
20  }
21  }
22 
23  SkillDescription BringObjectToLocation::Description = SkillDescription{
24  "BringObjectToLocation", "Bring an object to some location",
26  arondto::BringObjectToLandmarkAcceptedType::ToAronType(),
27  GetDefaultParameterization().toAron()
28  };
29 
31  BringObjectSkill(context),
32  SimpleSpecializedSkill<arondto::BringObjectToLandmarkAcceptedType>(Description)
33  {
34  }
35 
36  Skill::MainResult BringObjectToLocation::main(const SpecializedMainInput& in)
37  {
38  std::string objName = in.parameters.objectEntityId;
39  std::string graphName = in.parameters.graph;
40  std::string objLandmarkName = in.parameters.landmarkFrom;
41  std::string targetLandmarkName = in.parameters.landmarkTo;
42  std::string robotName = in.parameters.robotName;
43  float platformOrientationalAccuracy = 0.1;
44  float platformPositionalAccuracy = 20;
45  float tcpOrientationalAccuracy = 0.3;
46  float tcpPositionalAccuracy = 40;
47 
48  // move to landmark1
49  {
50  platform_control::arondto::MovePlatformToLandmarkAcceptedType params;
51  params.landmark = objLandmarkName;
52  params.robotName = robotName;
53  params.graph = graphName;
54  params.orientationalAccuracy = platformOrientationalAccuracy;
55  params.positionalAccuracy = platformPositionalAccuracy;
56 
58 
59  if (prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status != TerminatedSkillStatus::Succeeded)
60  {
61  return {TerminatedSkillStatus::Failed, nullptr};
62  }
63  }
64 
65  // grasp Object
66  {
67  grasp_object::arondto::GraspObjectAcceptedType params;
68  params.objectEntityId = objName;
69  params.robotName = robotName;
70  params.tcpOrientationalAccuracy = tcpOrientationalAccuracy;
71  params.tcpPositionalAccuracy = tcpPositionalAccuracy;
72  params.platformOrientationalAccuracy = platformOrientationalAccuracy;
73  params.platformPositionalAccuracy = platformPositionalAccuracy;
74 
76 
77  if (prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status != TerminatedSkillStatus::Succeeded)
78  {
79  return {TerminatedSkillStatus::Failed, nullptr};
80  }
81  }
82 
83  // Move to target landmark
84  {
85  platform_control::arondto::MovePlatformToLandmarkAcceptedType params;
86  params.landmark = targetLandmarkName;
87  params.robotName = robotName;
88  params.graph = graphName;
89  params.orientationalAccuracy = platformOrientationalAccuracy;
90  params.positionalAccuracy = platformPositionalAccuracy;
91 
93 
94  if (prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status != TerminatedSkillStatus::Succeeded)
95  {
96  return {TerminatedSkillStatus::Failed, nullptr};
97  }
98  }
99 
100  // putdown object
101  {
102  grasp_object::arondto::PutdownObjectAcceptedType params;
103  params.objectEntityId = objName;
104  params.robotName = robotName;
105  params.tcpOrientationalAccuracy = tcpOrientationalAccuracy;
106  params.tcpPositionalAccuracy = tcpPositionalAccuracy;
107  params.platformOrientationalAccuracy = platformOrientationalAccuracy;
108  params.platformPositionalAccuracy = platformPositionalAccuracy;
109 
111 
112  if (prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status != TerminatedSkillStatus::Succeeded)
113  {
114  return {TerminatedSkillStatus::Failed, nullptr};
115  }
116  }
117 
118  return {TerminatedSkillStatus::Succeeded, nullptr};
119  }
120 }
armarx::skills::PutdownObjectSkill::Description
static SkillDescription Description
Definition: PutdownObject.h:38
armarx::skills::Skill::manager
manager::dti::SkillManagerInterfacePrx manager
Definition: Skill.h:327
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
armarx::skills::BringObjectSkill::context
const BringObjectSkillContext & context
Definition: BringObjectSkill.h:69
armarx::skills
This file is part of ArmarX.
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::BringObjectSkillContext::platformControlSkillProvider
std::string platformControlSkillProvider
Definition: BringObjectSkill.h:47
armarx::skills::SkillProxy
Definition: SkillProxy.h:11
armarx::skills::BringObjectToLocation::BringObjectToLocation
BringObjectToLocation(const BringObjectSkillContext &context)
Definition: BringObjectToLocation.cpp:30
armarx::skills::MovePlatformToLandmark::Description
static SkillDescription Description
Definition: MovePlatformToLandmark.h:67
armarx::skills::SimpleSpecializedSkill
Definition: SimpleSpecializedSkill.h:10
armarx::skills::BringObjectSkillContext::graspControlSkillProvider
std::string graspControlSkillProvider
Definition: BringObjectSkill.h:46
armarx::skills::BringObjectToLocation::Description
static SkillDescription Description
Definition: BringObjectToLocation.h:57
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition: Skill.h:48
armarx::skills::TerminatedSkillStatus::Failed
@ Failed
armarx::skills::SimpleSpecializedSkill< arondto::BringObjectToLandmarkAcceptedType >::main
Skill::MainResult main() final
Definition: SimpleSpecializedSkill.h:71
armarx::skills::BringObjectSkill
Definition: BringObjectSkill.h:62
armarx::viz::toString
const char * toString(InteractionFeedbackType type)
Definition: Interaction.h:27
armarx::skills::BringObjectSkillContext
Definition: BringObjectSkill.h:44
armarx::skills::Skill::getSkillId
SkillID getSkillId() const
Get the id of the skill.
Definition: Skill.h:74
armarx::skills::GraspObjectSkill::Description
static SkillDescription Description
Definition: GraspObject.h:38
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition: Duration.cpp:55
BringObjectToLocation.h