@@ -394,15 +394,14 @@ ScrewTheoryIkProblem::JointIdsToSubproblem ScrewTheoryIkProblemBuilder::trySolve
394
394
// Find rightmost unknown and not simplified PoE term.
395
395
auto lastUnknown = std::find_if (poeTerms.rbegin (), poeTerms.rend (), unknownNotSimplifiedTerm);
396
396
int lastExpId = std::distance (poeTerms.begin (), lastUnknown.base ()) - 1 ;
397
- const MatrixExponential & lastExp = poe.exponentialAtJoint (lastExpId);
397
+ const auto & lastExp = poe.exponentialAtJoint (lastExpId);
398
398
399
399
// Select the most adequate subproblem, if available.
400
400
if (unknownsCount == 1 )
401
401
{
402
402
if (depth == 0 )
403
403
{
404
- if (lastExp.getMotionType () == MatrixExponential::ROTATION
405
- && !liesOnAxis (lastExp, testPoints[0 ]))
404
+ if (lastExp.getMotionType () == MatrixExponential::ROTATION && !liesOnAxis (lastExp, testPoints[0 ]))
406
405
{
407
406
poeTerms[lastExpId].known = true ;
408
407
return {{lastExpId}, new PadenKahanOne (lastExp, testPoints[0 ])};
@@ -450,19 +449,30 @@ ScrewTheoryIkProblem::JointIdsToSubproblem ScrewTheoryIkProblemBuilder::trySolve
450
449
}
451
450
452
451
int nextToLastExpId = lastExpId - 1 ;
453
- const MatrixExponential & nextToLastExp = poe.exponentialAtJoint (nextToLastExpId);
452
+ const auto & nextToLastExp = poe.exponentialAtJoint (nextToLastExpId);
454
453
455
454
if (depth == 0 )
456
455
{
457
- KDL::Vector r;
458
-
459
- if (lastExp.getMotionType () == MatrixExponential::ROTATION
460
- && nextToLastExp.getMotionType () == MatrixExponential::ROTATION
461
- && !parallelAxes (lastExp, nextToLastExp)
462
- && intersectingAxes (lastExp, nextToLastExp, r))
456
+ if (lastExp.getMotionType () == MatrixExponential::ROTATION && nextToLastExp.getMotionType () == MatrixExponential::ROTATION)
463
457
{
464
- poeTerms[lastExpId].known = poeTerms[nextToLastExpId].known = true ;
465
- return {{nextToLastExpId, lastExpId}, new PadenKahanTwo (nextToLastExp, lastExp, testPoints[0 ], r)};
458
+ if (!parallelAxes (lastExp, nextToLastExp))
459
+ {
460
+ poeTerms[lastExpId].known = poeTerms[nextToLastExpId].known = true ;
461
+
462
+ if (KDL::Vector r; intersectingAxes (lastExp, nextToLastExp, r))
463
+ {
464
+ return {{nextToLastExpId, lastExpId}, new PadenKahanTwo (nextToLastExp, lastExp, testPoints[0 ], r)};
465
+ }
466
+ else
467
+ {
468
+ return {{nextToLastExpId, lastExpId}, new PardosGotorSix (nextToLastExp, lastExp, testPoints[0 ])};
469
+ }
470
+ }
471
+ else if (!colinearAxes (lastExp, nextToLastExp))
472
+ {
473
+ poeTerms[lastExpId].known = poeTerms[nextToLastExpId].known = true ;
474
+ return {{nextToLastExpId, lastExpId}, new PardosGotorFour (nextToLastExp, lastExp, testPoints[0 ])};
475
+ }
466
476
}
467
477
468
478
if (lastExp.getMotionType () == MatrixExponential::TRANSLATION
@@ -472,15 +482,6 @@ ScrewTheoryIkProblem::JointIdsToSubproblem ScrewTheoryIkProblemBuilder::trySolve
472
482
poeTerms[lastExpId].known = poeTerms[nextToLastExpId].known = true ;
473
483
return {{nextToLastExpId, lastExpId}, new PardosGotorTwo (nextToLastExp, lastExp, testPoints[0 ])};
474
484
}
475
-
476
- if (lastExp.getMotionType () == MatrixExponential::ROTATION
477
- && nextToLastExp.getMotionType () == MatrixExponential::ROTATION
478
- && parallelAxes (lastExp, nextToLastExp)
479
- && !colinearAxes (lastExp, nextToLastExp))
480
- {
481
- poeTerms[lastExpId].known = poeTerms[nextToLastExpId].known = true ;
482
- return {{nextToLastExpId, lastExpId}, new PardosGotorFour (nextToLastExp, lastExp, testPoints[0 ])};
483
- }
484
485
}
485
486
}
486
487
0 commit comments