32 #include <VirtualRobot/IK/GenericIKSolver.h>
33 #include <VirtualRobot/LinkedCoordinate.h>
36 using namespace MotionControlGroup;
60 std::string kinChainName = getInput<std::string>(
"kinematicChainName");
61 float maxError = getInput<float>(
"targetPositionDistanceTolerance");
62 float maxErrorRot = getInput<float>(
"targetOrientationDistanceTolerance");
63 bool withOrientation = getInput<bool>(
"ikWithOrientation");
94 if (!robot->hasRobotNodeSet(kinChainName))
96 ARMARX_WARNING <<
"Robot does not know kinematic chain with name " << kinChainName <<
flush;
100 ARMARX_INFO <<
"Setting up ik solver for kin chain: " << kinChainName <<
", max position error:" << maxError <<
", max orientation erorr " << maxErrorRot <<
", useOrientation:" << withOrientation <<
armarx::flush;
101 VirtualRobot::GenericIKSolverPtr ikSolver(
new VirtualRobot::GenericIKSolver(robot->getRobotNodeSet(kinChainName), VirtualRobot::JacobiProvider::eSVDDamped));
102 ikSolver->setVerbose(
true);
103 ikSolver->setMaximumError(maxError, maxErrorRot);
104 ikSolver->setupJacobian(0.6f, 10);
113 Eigen::Matrix4f goalGlobal = robot->getRootNode()->toGlobalCoordinateSystem(goalInRoot);
121 if (!ikSolver->solve(goalGlobal, ikType, 5))
124 sendEvent<Failure>();
131 VirtualRobot::RobotNodeSetPtr kinematicChain = robot->getRobotNodeSet(kinChainName);
133 for (
int i = 0; i < (
signed int)kinematicChain->getSize(); i++)
136 targetJointValues.
addVariant(
Variant(kinematicChain->getNode(i)->getJointValue()));
137 ARMARX_LOG <<
" joint: " << kinematicChain->getNode(i)->getName() <<
" value: " << kinematicChain->getNode(i)->getJointValue() <<
flush;
144 setOutput(
"targetJointValues", targetJointValues);
145 sendEvent<EvCalculationDone>();
152 return "CalculateJointAngleConfiguration";