|
Robotics Library
0.7.0
|
Go to the documentation of this file.
27 #ifndef RL_MATH_QUATERNIONPOLYNOMIAL_H
28 #define RL_MATH_QUATERNIONPOLYNOMIAL_H
62 Real dtheta = y0.angularDistance(y1);
63 Vector3 e = (y0.inverse() * y1).vec();
65 if (e.norm() <= ::std::numeric_limits<Real>::epsilon())
76 f.
c[0] = Vector3::Zero();
78 f.
c[2] =
x1 * invB(e, dtheta, yd1) - 3 * e * dtheta;
88 Real dtheta = y0.angularDistance(y1);
89 Vector3 e = (y0.inverse() * y1).vec();
91 if (e.norm() <= ::std::numeric_limits<Real>::epsilon())
102 f.
c[0] = Vector3::Zero();
127 return this->
c.size() - 1;
147 assert(
derivative <= 2 &&
"Polynomial<Quaternion>: higher derivatives not implemented");
150 Real theta = axis.norm();
153 if (theta <= ::std::numeric_limits<Real>::epsilon())
159 u = axis.normalized();
171 Real thetad = u.dot(axisd);
172 Vector3 w = u.cross(axisd) / theta;
175 if (theta > ::std::numeric_limits<Real>::epsilon())
177 omega = u * thetad + ::std::sin(theta) * w.cross(u) - (1 - ::std::cos(theta)) * w;
193 Real thetadd = w.cross(u).dot(axisd) + u.dot(axisdd);
194 Vector3 wd = (u.cross(axisdd) - 2 * thetad * w) / theta;
197 if (theta > ::std::numeric_limits<Real>::epsilon())
199 omegad = u * thetadd + ::std::sin(theta) * wd.cross(u) - (1 - ::std::cos(theta)) * wd + thetad * w.cross(u) + omega.cross(u * thetad - w);
206 Quaternion ydd = y.secondDerivative(yd, omega, omegad);
229 ::std::vector<Vector3>
c;
246 f.
c[0] = Vector3::Zero();
250 for (::std::size_t i = 0; i < this->
degree(); ++i)
252 f.
c[i] = (
static_cast<Real>(this->
degree() - (i + 1) + 1) * this->c[i] +
static_cast<Real>(i + 1) * this->c[i + 1]) / (this->x1 - this->
x0);
264 Vector3 axis = Vector3::Zero();
266 for (::std::size_t i = 0; i < this->
degree() + 1; ++i)
276 if (dtheta <= ::std::numeric_limits<Real>::epsilon())
281 Real cosdtheta = ::std::cos(dtheta);
282 Real sindtheta = ::std::sin(dtheta);
284 return e.dot(x) * e + 0.5f * (dtheta * sindtheta) / (1 - cosdtheta) * e.cross(x).cross(e) + 0.5f * dtheta * e.cross(x);
290 #endif // RL_MATH_QUATERNIONPOLYNOMIAL_H
Quaternion< Scalar > pow(const Scalar &t) const
Definition: QuaternionBaseAddons.h:128
::std::size_t degree() const
Definition: PolynomialQuaternion.h:125
Real duration() const
Definition: PolynomialQuaternion.h:130
A mathematical mapping from Real -> ArrayX.
Definition: Function.h:45
Real x1
Definition: Function.h:104
::Eigen::Matrix< Real, 3, 1 > Vector3
Definition: Vector.h:46
static Vector3 invB(const Vector3 &e, const Real &dtheta, const Vector3 &x)
Definition: PolynomialQuaternion.h:274
Real x0
Definition: PolynomialQuaternion.h:231
Definition: PolynomialQuaternion.h:45
::std::size_t degree() const
Definition: Polynomial.h:199
Vector3 eval(const Real &x) const
Definition: PolynomialQuaternion.h:259
const Vector3 & coefficient(const ::std::size_t &i) const
Definition: PolynomialQuaternion.h:120
A vector-valued polynomial function from Real -> T.
Definition: Polynomial.h:61
Polynomial< Quaternion > * clone() const
Definition: PolynomialQuaternion.h:110
Real & upper()
Definition: Function.h:74
Polynomial derivative() const
Definition: Polynomial.h:204
Real & upper()
Definition: PolynomialQuaternion.h:216
static Polynomial< Quaternion > Linear(const Quaternion &y0, const Quaternion &y1, const Real &x1=1)
Definition: PolynomialQuaternion.h:86
Vector3 & coefficient(const ::std::size_t &i)
Definition: PolynomialQuaternion.h:115
Real x0
Definition: Function.h:102
::Eigen::AngleAxis< Real > AngleAxis
Definition: Rotation.h:50
Polynomial< Quaternion > derivative() const
Definition: PolynomialQuaternion.h:236
::std::vector< T > c
Definition: Polynomial.h:657
Quaternion operator()(const Real &x, const ::std::size_t &derivative=0) const
Evaluates the function or a derivative thereof for a given value x.
Definition: PolynomialQuaternion.h:145
::Eigen::Quaternion< Real > Quaternion
Definition: Quaternion.h:42
::std::vector< Vector3 > c
Definition: PolynomialQuaternion.h:229
static const Real FUNCTION_BOUNDARY
Definition: Function.h:110
Real x1
Definition: PolynomialQuaternion.h:233
Real & lower()
Definition: PolynomialQuaternion.h:135
Real & lower()
Definition: Function.h:64
Quaternion y0
Definition: PolynomialQuaternion.h:226
double Real
Definition: Real.h:42
static Polynomial< Quaternion > CubicFirst(const Quaternion &y0, const Quaternion &y1, const Vector3 &yd0, const Vector3 &yd1, const Real &x1=1)
Definition: PolynomialQuaternion.h:60
const Real & upper() const
Definition: PolynomialQuaternion.h:221
const Real & lower() const
Definition: PolynomialQuaternion.h:140
Robotics Library.
Definition: AnalogInput.cpp:30