MovePlatformForPutdown.cpp
Go to the documentation of this file.
2
4#include <RobotAPI/libraries/skills/provider/SkillProxy.h>
5
7
9
10namespace armarx::skills
11{
12 namespace
13 {
14 grasp_object::arondto::MovePlatformForPutdownAcceptedType
15 GetDefaultParameterization()
16 {
17 grasp_object::arondto::MovePlatformForPutdownAcceptedType ret;
18 ret.orientationalAccuracy = 0.01;
19 ret.positionalAccuracy = 25;
20 return ret;
21 }
22 } // namespace
23
25 "MovePlatformForPutdown",
26 "Move Platform in order to ease the putdown of an object",
27 {},
29 grasp_object::arondto::MovePlatformForPutdownAcceptedType::ToAronType(),
30 GetDefaultParameterization().toAron()};
31
40
42 MovePlatformForPutdownSkill::main(const SpecializedMainInput& in)
43 {
45 armem::obj::instance::Reader objectReader(mns);
46
47 robotReader.connect();
48 objectReader.connect();
49
50 // //////////////////////////////
51 // get robot
52 // //////////////////////////////
53 auto robot =
54 robotReader.getSynchronizedRobot(in.parameters.robotName,
56 VirtualRobot::RobotIO::RobotDescription::eStructure);
57 if (!robot)
58 {
59 ARMARX_ERROR << "Lost robot.";
60 return {TerminatedSkillStatus::Failed, nullptr};
61 }
62
63 // //////////////////////////////
64 // get object pose
65 // //////////////////////////////
66 auto objInstance = objectReader.queryLatestObjectInstance(in.parameters.objectEntityId);
67 if (!objInstance)
68 {
69 ARMARX_ERROR << "Lost object pose.";
70 return {TerminatedSkillStatus::Failed, nullptr};
71 }
72
73 // //////////////////////////////
74 // Exec move skill
75 // //////////////////////////////
77 {*robot, in.parameters.tcpName});
78
79 platform_control::arondto::MovePlatformToPoseAcceptedType params;
80 params.pose = targetPose.platformGlobalPose;
81 params.robotName = in.parameters.robotName;
82 params.orientationalAccuracy = in.parameters.orientationalAccuracy;
83 params.positionalAccuracy = in.parameters.positionalAccuracy;
84
85 SkillProxy prx({manager,
86 context.platformControlSkillProvider,
88 return {
89 prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status,
90 nullptr};
91 }
92} // namespace armarx::skills
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
The memory name system (MNS) client.
static DateTime Now()
Definition DateTime.cpp:51
MovePlatformForPutdownSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, TwoArmGraspControlSkillContext &)
grasp_object::arondto::MovePlatformForPutdownAcceptedType ArgType
manager::dti::SkillManagerInterfacePrx manager
Definition Skill.h:363
virtual MainResult main()
Override this method with the actual implementation.
Definition Skill.cpp:542
SkillID getSkillId() const
Get the id of the skill.
Definition Skill.cpp:587
TwoArmGraspControlSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, const std::string &layerName, TwoArmGraspControlSkillContext &c)
TwoArmGraspControlSkillContext & context
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
GetPlatformOffsetForObjectPutdownOutput GetGlobalPlatformPoseForObjectPutdown(const GetPlatformOffsetForObjectPutdownInput &in)
This file is part of ArmarX.
const char * toString(InteractionFeedbackType type)
Definition Interaction.h:28
A result struct for th main method of a skill.
Definition Skill.h:62
armem::client::MemoryNameSystem mns