@@ -570,6 +570,68 @@ namespace pinocchio
570570 }
571571 }
572572
573+ template <typename Scalar, int Options>
574+ void computeSplineKinematicsFull (
575+ int degree,
576+ const Eigen::Matrix<Scalar, Eigen::Dynamic, 1 > & knots,
577+ const std::vector<SE3Tpl<Scalar, Options>> & ctrlFrames,
578+ const std::vector<MotionTpl<Scalar, Options>> & relativeMotions,
579+ Scalar q,
580+ const Eigen::Matrix<Scalar, 1 , 1 , Options> & joint_v,
581+ bool computeVelocity,
582+ SE3Tpl<Scalar, Options> & M,
583+ MotionTpl<Scalar, Options> & v,
584+ MotionTpl<Scalar, Options> & c,
585+ JointMotionSubspaceTpl<1 , Scalar, Options, 1 > & S,
586+ Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> & basis)
587+ {
588+ deBoorBasisFull (degree, knots, q, basis);
589+
590+ M = ctrlFrames[0 ];
591+ S.matrix ().setZero ();
592+ if (computeVelocity)
593+ {
594+ v.setZero ();
595+ c.setZero ();
596+ }
597+
598+ const int nb_basis = ctrlFrames.size ();
599+ for (int i = 1 ; i < nb_basis; i++)
600+ {
601+ const int current_basis = i;
602+
603+ const Scalar phi_i = basis.row (degree).tail (nb_basis - i).sum ();
604+
605+ const Scalar phi_dot_i =
606+ internal::cumulativeBasisDerivativeFull (degree, knots, basis, current_basis, degree);
607+
608+ const SE3Tpl<Scalar, Options> transformation_temp (
609+ exp6 (relativeMotions[current_basis - 1 ] * phi_i));
610+ M = M * transformation_temp;
611+
612+ if (computeVelocity)
613+ {
614+ const Scalar phi_ddot_i =
615+ internal::cumulativeBasisDerivative2Full (degree, knots, basis, current_basis, degree);
616+
617+ c = relativeMotions[current_basis - 1 ] * phi_ddot_i
618+ + transformation_temp.actInv (
619+ c
620+ + MotionTpl<Scalar, Options>(S.matrix ()).cross (relativeMotions[current_basis - 1 ])
621+ * phi_dot_i);
622+ }
623+
624+ S.matrix () =
625+ transformation_temp.actInv (S) + relativeMotions[current_basis - 1 ].toVector () * phi_dot_i;
626+ }
627+ if (computeVelocity)
628+ {
629+ // C = Sdot * qdot = (dS/dq * qdot) * dot
630+ c = c * joint_v[0 ] * joint_v[0 ];
631+ v = S * joint_v;
632+ }
633+ }
634+
573635 } // namespace internal
574636
575637} // namespace pinocchio
0 commit comments