Skip to content
Snippets Groups Projects

Implement 'PointAt'-skill

Merged Patrick Dormanns requested to merge feat/pointing-skill into main
2 files
+ 20
8
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -33,7 +33,7 @@ namespace armarx::control::pointing::core
Eigen::Vector3f target = params.target.toGlobalEigen(robot);
visualizeTarget(target);
armarx::TrajectoryPtr traj = computTrajectory(robot, params.side, target);
armarx::TrajectoryPtr traj = computeArmTrajectory(robot, params.side, target);
addWristTrajectory(robot, params.side, traj);
@@ -82,7 +82,7 @@ namespace armarx::control::pointing::core
}
TrajectoryPtr
Pointing::computTrajectory(VirtualRobot::RobotPtr robot, Side side, Eigen::Vector3f target)
Pointing::computeArmTrajectory(VirtualRobot::RobotPtr robot, Side side, Eigen::Vector3f target)
{
ARMARX_VERBOSE << "Computing trajectory...";
auto ik = PointingIK(robot, side, target);
@@ -101,11 +101,13 @@ namespace armarx::control::pointing::core
}
if (aborted)
{
ARMARX_INFO << "Pointing aborted.";
ARMARX_INFO << "Pointing aborted";
throw armarx::exceptions::local::PointingAbortedException();
}
} while (not ik.isTargetReached());
ARMARX_VERBOSE << "Done computing trajectory";
return ik.getTrajectory();
}
@@ -135,13 +137,23 @@ namespace armarx::control::pointing::core
Side side,
const std::string& shapeName)
{
auto eefName = std::string("Hand_") + (side == Side::LEFT ? "L" : "R") + "_EEF"; // TODO
auto eef = robot->getEndEffector(eefName);
auto humanMapping = robot->getHumanMapping();
ARMARX_CHECK(humanMapping) << "Robot '" << robot->getName() << "' has no human mapping";
auto armDescription = (side == LEFT) ? humanMapping->leftArm : humanMapping->rightArm;
auto tcp = armDescription.segments.tcp.nodeName;
// get endeffector whichs tcp-name matches the tcp-name of the according hand
auto eefs = robot->getEndEffectors();
auto eef = std::find_if(eefs.begin(),
eefs.end(),
[&tcp](VirtualRobot::EndEffectorPtr eef)
{ return eef->getTcpName() == tcp; });
ARMARX_CHECK(eef != eefs.end());
auto shape = eef->getPreshape(shapeName);
auto shape = (*eef)->getPreshape(shapeName);
if (not shape)
{
ARMARX_ERROR << "Hand '" << eefName << "' has no shape '" << shape << "'";
ARMARX_ERROR << "Hand '" << (*eef)->getName() << "' has no shape '" << shapeName << "'";
throw armarx::exceptions::local::PointingFailedException();
}
return shape->getRobotNodeJointValueMap();
Loading