3#include <VirtualRobot/RobotNodeSet.h>
11 .skillId = {.skillName =
"CloseHandAndAttach"},
12 .description =
"Close the hand and attach an object to it",
14 .parametersType = grasp_object::arondto::CloseHandAndAttachAcceptedType::ToAronType(),
42 VirtualRobot::RobotIO::RobotDescription::eStructure);
54 std::this_thread::sleep_for(std::chrono::milliseconds(500));
64 skills::hand_control::arondto::CloseHandAcceptedType params;
65 params.kinematicChainName = in.parameters.kinematicChainName;
67 SkillProxy prx(
manager, SkillID{
68 .providerId = ProviderID{.providerName =
"HandControlSkillProvider"},
70 auto su = prx.executeSkill(in.executorName, params.toAron());
75 auto objPoseInGlobalFrame = objInstance->objectPoseGlobal;
76 auto objPoseInRootFrame =
77 robot->getRootNode()->toLocalCoordinateSystem(objPoseInGlobalFrame);
78 auto objPoseInTCPFrame = robot->getRobotNodeSet(in.parameters.kinematicChainName)
80 ->toLocalCoordinateSystem(objPoseInGlobalFrame);
82 armem::arondto::ObjectInstance arondto;
86 arondto.pose.attachmentValid =
true;
87 arondto.pose.attachment.agentName = robot->getName();
88 arondto.pose.attachment.frameName =
89 robot->getRobotNodeSet(in.parameters.kinematicChainName)->getTCP()->getName();
90 arondto.pose.attachment.poseInFrame = objPoseInTCPFrame;
91 arondto.pose.objectPoseRobot = objPoseInRootFrame;
92 arondto.pose.robotPose = objPoseInGlobalFrame;
93 arondto.pose.robotConfig = robot->getJointValues();
97 return {su.status,
nullptr};
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
The memory name system (MNS) client.
std::optional< objpose::ObjectPose > queryLatestObjectInstance(const ObjectID &instanceId)
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
std::map< std::string, bool > requestLocalization(const ObjectID &instanceId, const armarx::core::time::Duration &until)
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
bool commitObject(const armem::arondto::ObjectInstance &inst, const std::string &provider, const armem::Time &)
virtual void connect(armem::client::MemoryNameSystem &memoryNameSystem)
The VirtualRobotReader class.
VirtualRobot::RobotPtr getSynchronizedRobot(const std::string &name, const VirtualRobot::RobotIO::RobotDescription &loadMode=VirtualRobot::RobotIO::RobotDescription::eStructure, bool blocking=true)
bool synchronizeRobot(VirtualRobot::Robot &robot, const armem::Time ×tamp) const
Synchronize both the platform pose and the joint values of a virtual robot, according to the robot st...
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
CloseHandAndAttachSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, TwoArmGraspControlSkillContext &)
grasp_object::arondto::CloseHandAndAttachAcceptedType ArgType
static SkillDescription Description
static SkillDescription Description
manager::dti::SkillManagerInterfacePrx manager
virtual MainResult main()
Override this method with the actual implementation.
TwoArmGraspControlSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, const std::string &layerName, TwoArmGraspControlSkillContext &c)
TwoArmGraspControlSkillContext & context
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
void toAron(arondto::MemoryID &dto, const MemoryID &bo)
This file is part of ArmarX.
A result struct for th main method of a skill.
armarx::viz::Client arviz
armem::client::MemoryNameSystem & mns