Drake
PiecewiseQuaternionSlerp< Scalar > Class Template Referencefinal

A class representing a trajectory for quaternions that are interpolated using piecewise slerp (spherical linear interpolation). More...

#include <drake/common/trajectories/piecewise_quaternion.h>

Inheritance diagram for PiecewiseQuaternionSlerp< Scalar >:
[legend]
Collaboration diagram for PiecewiseQuaternionSlerp< Scalar >:
[legend]

Public Member Functions

 PiecewiseQuaternionSlerp ()
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const eigen_aligned_std_vector< Quaternion< Scalar >> &quaternions)
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const eigen_aligned_std_vector< Matrix3< Scalar >> &rot_matrices)
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const eigen_aligned_std_vector< AngleAxis< Scalar >> &ang_axes)
 
Eigen::Index rows () const override
 
Eigen::Index cols () const override
 
Quaternion< Scalar > orientation (double t) const
 Interpolates orientation. More...
 
Vector3< Scalar > angular_velocity (double t) const
 Interpolates angular velocity. More...
 
Vector3< Scalar > angular_acceleration (double t) const
 Interpolates angular acceleration. More...
 
const eigen_aligned_std_vector< Quaternion< Scalar > > & get_quaternion_knots () const
 Getter for the internal quaternion knots. More...
 
bool is_approx (const PiecewiseQuaternionSlerp< Scalar > &other, const Scalar &tol) const
 Returns true if all the corresponding segment times are within tol seconds, and the angle difference between the corresponding quaternion knot points are within tol. More...
 
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 PiecewiseQuaternionSlerp (const PiecewiseQuaternionSlerp &)=default
 
PiecewiseQuaternionSlerpoperator= (const PiecewiseQuaternionSlerp &)=default
 
 PiecewiseQuaternionSlerp (PiecewiseQuaternionSlerp &&)=default
 
PiecewiseQuaternionSlerpoperator= (PiecewiseQuaternionSlerp &&)=default
 
- Public Member Functions inherited from PiecewiseFunction
 PiecewiseFunction (std::vector< double > const &breaks)
 
virtual ~PiecewiseFunction ()
 
int getNumberOfSegments () const
 
double getStartTime (int segment_number) const
 
double getEndTime (int segment_number) const
 
double getDuration (int segment_number) const
 
double getStartTime () const
 
double getEndTime () const
 
bool isTimeInRange (double t) const
 Returns true iff t >= getStartTime() && t <= getEndTime(). More...
 
int getSegmentIndex (double t) const
 
const std::vector< double > & getSegmentTimes () const
 
void segmentNumberRangeCheck (int segment_number) const
 

Additional Inherited Members

- Static Public Member Functions inherited from PiecewiseFunction
static std::vector< doublerandomSegmentTimes (int num_segments, std::default_random_engine &generator)
 
- Static Public Attributes inherited from PiecewiseFunction
static constexpr double kEpsilonTime = 1e-10
 Minimum delta quantity used for comparing time. More...
 
- Protected Member Functions inherited from PiecewiseFunction
bool segmentTimesEqual (const PiecewiseFunction &b, double tol=kEpsilonTime) const
 
void checkScalarValued () const
 
 PiecewiseFunction ()
 
- Protected Attributes inherited from PiecewiseFunction
std::vector< doublebreaks
 

Detailed Description

template<typename Scalar = double>
class drake::PiecewiseQuaternionSlerp< Scalar >

A class representing a trajectory for quaternions that are interpolated using piecewise slerp (spherical linear interpolation).

All the orientation knots are expected to be with respect to the same parent reference frame, i.e. q_i represents the rotation R_PBi for the orientation of frame B at the ith knot in a fixed parent frame P. The world frame is a common choice for the parent frame. The angular velocity and acceleration are also relative to the parent frame and expressed in the parent frame. Since there is a sign ambiguity when using quaternions to represent orientation, namely q and -q represent the same orientation, the internal quaternion representations ensure that q_n.dot(q_{n+1}) >= 0. Another intuitive way to think about this is that consecutive quaternions have the shortest geodesic distance on the unit sphere.

Template Parameters
Scalar,double.

Constructor & Destructor Documentation

PiecewiseQuaternionSlerp ( const PiecewiseQuaternionSlerp< Scalar > &  )
default

Here is the caller graph for this function:

PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const eigen_aligned_std_vector< Quaternion< Scalar >> &  quaternions 
)
PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const eigen_aligned_std_vector< Matrix3< Scalar >> &  rot_matrices 
)
PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const eigen_aligned_std_vector< AngleAxis< Scalar >> &  ang_axes 
)

Here is the call graph for this function:

Member Function Documentation

Vector3< Scalar > angular_acceleration ( double  t) const

Interpolates angular acceleration.

Parameters
tTime for interpolation.
Returns
The interpolated angular acceleration at t, which is always zero for slerp.

Here is the caller graph for this function:

Vector3< Scalar > angular_velocity ( double  t) const

Interpolates angular velocity.

Parameters
tTime for interpolation.
Returns
The interpolated angular velocity at t, which is constant per segment.

Here is the call graph for this function:

Here is the caller graph for this function:

Eigen::Index cols ( ) const
inlineoverridevirtual

Implements PiecewiseFunction.

const eigen_aligned_std_vector<Quaternion<Scalar> >& get_quaternion_knots ( ) const
inline

Getter for the internal quaternion knots.

Note: the returned quaternions might be different from the ones used for construction because the internal representations are set to always be the "closest" w.r.t to the previous one.

Returns
the internal knot points.
bool is_approx ( const PiecewiseQuaternionSlerp< Scalar > &  other,
const Scalar &  tol 
) const

Returns true if all the corresponding segment times are within tol seconds, and the angle difference between the corresponding quaternion knot points are within tol.

Here is the call graph for this function:

Here is the caller graph for this function:

PiecewiseQuaternionSlerp& operator= ( const PiecewiseQuaternionSlerp< Scalar > &  )
default
PiecewiseQuaternionSlerp& operator= ( PiecewiseQuaternionSlerp< Scalar > &&  )
default
Quaternion< Scalar > orientation ( double  t) const

Interpolates orientation.

Parameters
tTime for interpolation.
Returns
The interpolated quaternion at t.

Here is the call graph for this function:

Here is the caller graph for this function:

Eigen::Index rows ( ) const
inlineoverridevirtual

Implements PiecewiseFunction.


The documentation for this class was generated from the following files: