3 #include <VirtualRobot/RobotNodeSet.h>
26 <<
" arm at " << params.
target
38 addWristTrajectory(robot, params.
side, traj);
42 auto shapeJointValues = getShapeJointValues(robot, params.
side, *params.
handShape);
43 addHandTrajectory(robot, traj, shapeJointValues);
46 traj = traj->calculateTimeOptimalTrajectory(
77 robot->hasRobotNode(framedPosition.frame)))
79 ARMARX_ERROR <<
"'" << framedPosition.frame <<
"' is not a valid frame name";
86 Pointing::visualizeTarget(
const Eigen::Vector3f&
target)
100 auto ik = PointingIK(robot, side,
target);
102 if (ik.isTargetReached())
109 if (ik.optimize() < 1e-6)
119 }
while (not ik.isTargetReached());
123 return ik.getTrajectory();
129 auto humanMapping = robot->getHumanMapping();
130 ARMARX_CHECK(humanMapping) <<
"Robot '" << robot->getName() <<
"' has no human mapping";
132 auto armDescription = (side ==
LEFT) ? humanMapping->leftArm : humanMapping->rightArm;
133 auto wrist = armDescription.segments.wrist.nodeName;
135 auto nodeSetArm = robot->getRobotNodeSet(armDescription.nodeSet);
138 std::for_each(nodeSetArm->begin() + nodeSetArm->getRobotNodeIndex(wrist),
140 [traj](VirtualRobot::RobotNodePtr robotNode) {
141 traj->addDimension({robotNode->getJointValue(), 0.0},
143 robotNode->getName());
147 std::map<std::string, float>
150 const std::string& shapeName)
152 auto humanMapping = robot->getHumanMapping();
153 ARMARX_CHECK(humanMapping) <<
"Robot '" << robot->getName() <<
"' has no human mapping";
154 auto armDescription = (side ==
LEFT) ? humanMapping->leftArm : humanMapping->rightArm;
155 auto tcp = armDescription.segments.tcp.nodeName;
158 auto eefs = robot->getEndEffectors();
159 auto eef = std::find_if(eefs.begin(),
161 [&tcp](VirtualRobot::EndEffectorPtr eef)
162 { return eef->getTcpName() == tcp; });
165 auto shape = (*eef)->getPreshape(shapeName);
168 ARMARX_ERROR <<
"Hand '" << (*eef)->getName() <<
"' has no shape '" << shapeName <<
"'";
171 return shape->getRobotNodeJointValueMap();
177 const std::map<std::string, float>& shapeJointValues)
179 for (
const auto& [jointName, targetValue] : shapeJointValues)
181 traj->addDimension({robot->getRobotNode(jointName)->getJointValue(), targetValue},
190 ARMARX_INFO <<
"Playing trajectory (" << traj->getTimeLength() <<
"s)";
191 remote_.trajectoryPlayer->loadJointTraj(traj);
192 remote_.trajectoryPlayer->startTrajectoryPlayer();
203 ARMARX_INFO <<
"Pointing aborted. Stopping trajectory";
204 remote_.trajectoryPlayer->stopTrajectoryPlayer();