10 #ifndef EIGEN_LGSM_GROUP_SE3_CUBIC_INTERPOLATOR_H 11 #define EIGEN_LGSM_GROUP_SE3_CUBIC_INTERPOLATOR_H 25 typedef std::vector<Twist<Scalar>, aligned_allocator<Twist<Scalar> > >
StdVectorTwist;
29 void setControlPoint(
const StdVectorDisplacement& controlPoints,
const StdVectorTwist& controlVelocities,
const std::vector<Scalar>&
t);
35 std::vector<Scalar>
t;
42 template<
typename Scalar>
46 H1 = controlPoints[0];
61 std::vector<Scalar> step; step.reserve(
n - 1);
62 std::vector<Scalar> li; li.reserve(
n);
63 std::vector<Scalar> mui; mui.reserve(
n);
70 for(
typename StdVectorDisplacement::const_iterator iter = controlPoints.begin(); iter != controlPoints.end(); iter++){
71 ctrlPts.push_back(offset*(*iter));
72 ksi.push_back(ctrlPts.back().log());
75 for(
unsigned int i = 0; i <
n - 1; i++)
76 step.push_back(
t[i+1] -
t[i]);
79 alpha.push_back(3*((
ksi[1] -
ksi[0])/step[0] - dksi1));
81 for(
unsigned int i = 1; i < n - 1; i++){
82 alpha.push_back(3*((
ksi[i+1] -
ksi[i])/step[i] - (
ksi[i] -
ksi[i-1])/step[i-1]));
88 Matrix<Scalar, 6, 6> tm =
ksi.back().dexp().inverse();
92 Twist<Scalar> dksin =
ksi.back().dexp().inverse() * controlVelocities.back();
93 alpha.push_back(3*(dksin-(
ksi.back() -
ksi[n-2])/step.back()));
96 li.push_back(2*step[0]);
98 zi.push_back(alpha[0]/li[0]);
100 for(
unsigned int i = 1; i < n - 1; i++){
101 li.push_back(2*(
t[i+1]-
t[i-1]) - step[i-1]*mui[i-1]);
102 mui.push_back(step[i]/li[i]);
103 zi.push_back((alpha[i]-step[i-1]*zi[i-1])/li[i]);
106 li.push_back(step[n-2]*(2 - mui[n-2]));
107 zi.push_back((alpha.back()-step[n-2]*zi[n-2])/li.back());
109 ci.push_back(zi.back());
111 for(
unsigned int i = 1; i <
n; i++){
112 ci.push_back(zi[n-i-1] - mui[n-i-1]*
ci[i-1]);
113 bi.push_back((
ksi[n-i]-
ksi[n-i-1])/step[n-i-1]-step[n-i-1]*(
ci[i-1]+2*
ci[i])/3);
114 di.push_back((
ci[i-1]-
ci[i])/3/step[n-i-1]);
118 template<
typename Scalar>
122 assert(time >
t[0] || time <
t[
n-1]);
125 for(
size_t i = 0; i <
n-1; i++){
132 Scalar dt = time-
t[k];
142 vel = ksik.dexp()*dkisk;
void setControlPoint(const StdVectorDisplacement &controlPoints, const StdVectorTwist &controlVelocities, const std::vector< Scalar > &t)
Class describing a Twist.
void Interpolate(Displacement< Scalar > &pos, Twist< Scalar > &vel, const Scalar time) const
Group exp(Scalar precision=1.e-6) const
PlainObject inverse() const
std::vector< Displacement< Scalar >, aligned_allocator< Displacement< Scalar > > > StdVectorDisplacement
std::vector< Twist< Scalar >, aligned_allocator< Twist< Scalar > > > StdVectorTwist
Displacement< Scalar > H1