1#include <SimoxUtility/algorithm/string/string_tools.h>
4#include <VirtualRobot/RobotNodeSet.h>
18 grasp_object::arondto::ExecutePutdownAcceptedType
19 GetDefaultParameterization()
21 grasp_object::arondto::ExecutePutdownAcceptedType ret;
22 ret.orientationalAccuracy = 0.01;
23 ret.positionalAccuracy = 25;
29 .skillId = {.skillName =
"ExecutePutdown"},
30 .description =
"Execute a putdown for some grasped object",
31 .rootProfileDefaults = GetDefaultParameterization().toAron(),
33 .parametersType = grasp_object::arondto::ExecutePutdownAcceptedType::ToAronType(),
61 VirtualRobot::RobotIO::RobotDescription::eStructure);
79 ARMARX_CHECK(objInstance->attachment->agentName == in.parameters.robotName);
81 std::string kinematicChainName =
"LeftArm";
82 std::string otherArmKinematicChainName =
"RightArm";
83 if (simox::alg::ends_with(objInstance->attachment->frameName,
" R"))
85 kinematicChainName =
"RightArm";
86 otherArmKinematicChainName =
"LeftArm";
93 skills::joint_control::arondto::MoveJointsToPositionAcceptedType params;
94 params.robotName = in.parameters.robotName;
95 params.jointTargetTolerance = 0.03;
96 params.jointMaxSpeed = 0.75;
97 params.accelerationTime = 500;
98 params.setVelocitiesToZeroAtEnd =
true;
100 params.targetJointMap[robot->getRobotNodeSet(otherArmKinematicChainName)
101 ->getNodeNames()[0]] = 0.47;
102 params.targetJointMap[robot->getRobotNodeSet(otherArmKinematicChainName)
103 ->getNodeNames()[1]] = 0.0;
104 params.targetJointMap[robot->getRobotNodeSet(otherArmKinematicChainName)
105 ->getNodeNames()[2]] = 0.0;
106 params.targetJointMap[robot->getRobotNodeSet(otherArmKinematicChainName)
107 ->getNodeNames()[3]] = 0.32;
108 params.targetJointMap[robot->getRobotNodeSet(otherArmKinematicChainName)
109 ->getNodeNames()[4]] = 0.47;
111 SkillProxy prx(
manager, SkillID{
112 .providerId = ProviderID{.providerName =
context.jointControlSkillProvider},
115 if (prx.executeSkill(in.executorName, params.toAron())
124 skills::joint_control::arondto::MoveJointsToPositionAcceptedType params;
125 params.robotName = in.parameters.robotName;
126 params.jointTargetTolerance = 0.03;
127 params.jointMaxSpeed = 0.75;
128 params.accelerationTime = 500;
129 params.setVelocitiesToZeroAtEnd =
true;
130 params.targetJointMap[
"Neck_1_Pitch"] = 0.6;
132 SkillProxy prx(
manager, SkillID{
133 .providerId = ProviderID{.providerName =
context.jointControlSkillProvider},
136 if (prx.executeSkill(in.executorName, params.toAron())
145 const auto objPoseLocal = objInstance->objectPoseRobot;
146 const auto objPoseGlobal = robot->getRootNode()->toGlobalCoordinateSystem(objPoseLocal);
147 const auto objectInTCPFrame = objInstance->attachment->poseInFrame;
148 Eigen::Matrix4f tcpPlacePoseGlobal = objPoseGlobal * objectInTCPFrame.inverse();
149 tcpPlacePoseGlobal(2, 3) += 50;
151 auto tcpPlacePrePoseGlobal = tcpPlacePoseGlobal;
152 tcpPlacePrePoseGlobal(2, 3) += 80;
154 std::vector<Eigen::Matrix4f> targetPosesGlobal = {tcpPlacePrePoseGlobal,
157 for (
const auto& tcpTargetPoseGlobal : targetPosesGlobal)
159 skills::tcp_control::arondto::MoveTCPToTargetPoseAcceptedType params;
160 params.robotName = in.parameters.robotName;
161 params.kinematicChainName = kinematicChainName;
162 params.targetPoseGlobal = tcpTargetPoseGlobal;
163 params.orientationalAccuracy = in.parameters.orientationalAccuracy;
164 params.positionalAccuracy = in.parameters.positionalAccuracy;
166 SkillProxy prx(
manager, SkillID{
167 .providerId = ProviderID{.providerName =
context.tcpControlSkillProvider},
170 if (prx.executeSkill(in.executorName, params.toAron())
179 skills::joint_control::arondto::MoveJointsToPositionAcceptedType params;
180 params.robotName = in.parameters.robotName;
181 params.jointTargetTolerance = 0.03;
182 params.jointMaxSpeed = 0.75;
183 params.accelerationTime = 500;
184 params.setVelocitiesToZeroAtEnd =
true;
185 params.targetJointMap[
"Neck_1_Pitch"] = 0.0;
187 SkillProxy prx(
manager, SkillID{
188 .providerId = ProviderID{.providerName =
context.jointControlSkillProvider},
191 if (prx.executeSkill(in.executorName, params.toAron())
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
The memory name system (MNS) client.
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
std::optional< objpose::ObjectPose > queryLatestObjectInstance(const ObjectID &instanceId)
void connect(armem::client::MemoryNameSystem &memoryNameSystem)
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...
ExecutePutdownSkill(armem::client::MemoryNameSystem &mns, armarx::viz::Client &arviz, TwoArmGraspControlSkillContext &)
static SkillDescription Description
grasp_object::arondto::ExecutePutdownAcceptedType 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.
This file is part of ArmarX.
A result struct for th main method of a skill.
armarx::viz::Client arviz
armem::client::MemoryNameSystem & mns