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