3 #include <VirtualRobot/RobotNodeSet.h>
5 #include <RobotAPI/libraries/skills/provider/SkillProxy.h>
13 "Close the hand and attach an object to it",
16 grasp_object::arondto::CloseHandAndAttachAcceptedType::ToAronType()};
33 robotReader.connect();
34 objectWriter.connect();
35 objectReader.connect();
41 robotReader.getSynchronizedRobot(in.parameters.robotName,
43 VirtualRobot::RobotIO::RobotDescription::eStructure);
53 objectReader.requestLocalization(in.parameters.objectEntityId,
55 std::this_thread::sleep_for(std::chrono::milliseconds(500));
57 auto objInstance = objectReader.queryLatestObjectInstance(in.parameters.objectEntityId);
65 skills::hand_control::arondto::CloseHandAcceptedType params;
66 params.kinematicChainName = in.parameters.kinematicChainName;
69 auto su = prx.executeFullSkill(
getSkillId().
toString(in.executorName), params.toAron());
72 objInstance = objectReader.queryLatestObjectInstance(in.parameters.objectEntityId);
74 auto objPoseInGlobalFrame = objInstance->objectPoseGlobal;
75 auto objPoseInRootFrame =
76 robot->getRootNode()->toLocalCoordinateSystem(objPoseInGlobalFrame);
77 auto objPoseInTCPFrame = robot->getRobotNodeSet(in.parameters.kinematicChainName)
79 ->toLocalCoordinateSystem(objPoseInGlobalFrame);
81 armem::arondto::ObjectInstance arondto;
85 arondto.pose.attachmentValid =
true;
86 arondto.pose.attachment.agentName = robot->getName();
87 arondto.pose.attachment.frameName = robot->getRobotNodeSet(in.parameters.kinematicChainName)->getTCP()->getName();
88 arondto.pose.attachment.poseInFrame = objPoseInTCPFrame;
89 arondto.pose.objectPoseRobot = objPoseInRootFrame;
90 arondto.pose.robotPose = objPoseInGlobalFrame;
91 arondto.pose.robotConfig = robot->getJointValues();
93 objectWriter.commitObject(arondto, objInstance->providerName,
armem::Time::Now());
95 return {su.status,
nullptr};