Skip to content
Snippets Groups Projects
Commit 441095de authored by Simon Ottenhaus's avatar Simon Ottenhaus
Browse files

try to fix head ik

parent 746ea9f4
No related branches found
No related tags found
No related merge requests found
......@@ -205,11 +205,27 @@ namespace armarx
auto globalPos = targetPosition->toGlobal(localRobot);
ARMARX_VERBOSE << "Calculating IK for target position " << targetPosition->output();
ARMARX_VERBOSE << "Calculating IK for target position (global) " << globalPos->output();
if (!ikSolver.solve(globalPos->toEigen()))
Eigen::Vector3f targetEigen = globalPos->toEigen();
bool solutionFound = false;
if (!ikSolver.solve(targetEigen))
{
ARMARX_WARNING << "IKSolver found no solution!";
ARMARX_IMPORTANT << "IKSolver found no solution, retrying 10cm higher";
targetEigen(2) += 100.0f; // add 10cm to z component
if (!ikSolver.solve(targetEigen))
{
ARMARX_WARNING << "IKSolver found no solution!";
}
else
{
solutionFound = true;
}
}
else
{
solutionFound = true;
}
if (solutionFound)
{
ARMARX_DEBUG << "Solution found";
NameValueMap targetJointAngles;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment