MovePlatformForGrasp.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::MovePlatformForGraspAcceptedType
15 GetDefaultParameterization()
16 {
17 grasp_object::arondto::MovePlatformForGraspAcceptedType ret;
18 ret.orientationalAccuracy = 0.01;
19 ret.positionalAccuracy = 25;
20 return ret;
21 }
22 } // namespace
23
25 "MovePlatformForGrasp",
26 "Move Platform in order to ease the grasp of an object",
27 {},
29 grasp_object::arondto::MovePlatformForGraspAcceptedType::ToAronType(),
30 GetDefaultParameterization().toAron()};
31
39
41 MovePlatformForGraspSkill::main(const SpecializedMainInput& in)
42 {
44 armem::obj::instance::Reader objectReader(mns);
45
46 robotReader.connect();
47 objectReader.connect();
48
49 // //////////////////////////////
50 // get robot
51 // //////////////////////////////
52 auto robot =
53 robotReader.getSynchronizedRobot(in.parameters.robotName,
55 VirtualRobot::RobotIO::RobotDescription::eStructure);
56 if (!robot)
57 {
58 ARMARX_ERROR << "Lost robot.";
59 return {TerminatedSkillStatus::Failed, nullptr};
60 }
61
62 // //////////////////////////////
63 // get object pose
64 // //////////////////////////////
65 auto objInstance = objectReader.queryLatestObjectInstance(in.parameters.objectEntityId);
66 if (!objInstance)
67 {
68 ARMARX_ERROR << "Lost object pose.";
69 return {TerminatedSkillStatus::Failed, nullptr};
70 }
71
72 // //////////////////////////////
73 // Exec move skill
74 // //////////////////////////////
76 {*objInstance, *robot, in.parameters.tcpName});
77
78 skills::platform_control::arondto::MovePlatformToPoseAcceptedType params;
79 params.robotName = in.parameters.robotName;
80 params.orientationalAccuracy = in.parameters.orientationalAccuracy;
81 params.positionalAccuracy = in.parameters.positionalAccuracy;
82 params.pose = targetPose.platformGlobalPose;
83
84 SkillProxy prx({manager,
85 context.platformControlSkillProvider,
87 return {
88 prx.executeFullSkill(getSkillId().toString(in.executorName), params.toAron()).status,
89 nullptr};
90 }
91} // 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
grasp_object::arondto::MovePlatformForGraspAcceptedType ArgType
MovePlatformForGraspSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, TwoArmGraspControlSkillContext &)
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
GetPlatformOffsetForObjectGraspOutput GetGlobalPlatformPoseForObjectGrasp(const GetPlatformOffsetForObjectGraspInput &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