Drake
PiecewiseQuaternionSlerp< T > 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< T >:
[legend]
Collaboration diagram for PiecewiseQuaternionSlerp< T >:
[legend]

Public Member Functions

 PiecewiseQuaternionSlerp ()=default
 Builds an empty PiecewiseQuaternionSlerp. More...
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const std::vector< Quaternion< T >> &quaternions)
 Builds a PiecewiseQuaternionSlerp. More...
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const std::vector< Matrix3< T >> &rot_matrices)
 Builds a PiecewiseQuaternionSlerp. More...
 
 PiecewiseQuaternionSlerp (const std::vector< double > &breaks, const std::vector< AngleAxis< T >> &ang_axes)
 Builds a PiecewiseQuaternionSlerp. More...
 
 ~PiecewiseQuaternionSlerp () override=default
 
std::unique_ptr< Trajectory< T > > Clone () const override
 
Eigen::Index rows () const override
 
Eigen::Index cols () const override
 
Quaternion< T > orientation (double t) const
 Interpolates orientation. More...
 
MatrixX< T > value (double t) const override
 Evaluates the trajectory at the given time t. More...
 
Vector3< T > angular_velocity (double t) const
 Interpolates angular velocity. More...
 
std::unique_ptr< Trajectory< T > > MakeDerivative (int derivative_order=1) const override
 
Vector3< T > angular_acceleration (double t) const
 Interpolates angular acceleration. More...
 
const std::vector< Quaternion< T > > & get_quaternion_knots () const
 Getter for the internal quaternion knots. More...
 
bool is_approx (const PiecewiseQuaternionSlerp< T > &other, const T &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 PiecewiseTrajectory< T >
 ~PiecewiseTrajectory () override=default
 
int get_number_of_segments () const
 
double start_time (int segment_number) const
 
double end_time (int segment_number) const
 
double duration (int segment_number) const
 
double start_time () const override
 
double end_time () const override
 
bool is_time_in_range (double t) const
 Returns true iff t >= getStartTime() && t <= getEndTime(). More...
 
int get_segment_index (double t) const
 
const std::vector< double > & get_segment_times () const
 
void segment_number_range_check (int segment_number) const
 
- Public Member Functions inherited from Trajectory< T >
virtual ~Trajectory ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from PiecewiseTrajectory< T >
static std::vector< doubleRandomSegmentTimes (int num_segments, std::default_random_engine &generator)
 
- Static Public Attributes inherited from PiecewiseTrajectory< T >
static constexpr double kEpsilonTime = 1e-10
 Minimum delta quantity used for comparing time. More...
 
- Protected Member Functions inherited from PiecewiseTrajectory< T >
 PiecewiseTrajectory ()=default
 
 PiecewiseTrajectory (const std::vector< double > &breaks)
 breaks increments must be greater or equal to kEpsilonTime. More...
 
bool SegmentTimesEqual (const PiecewiseTrajectory &b, double tol=kEpsilonTime) const
 
const std::vector< double > & breaks () const
 
std::vector< double > & get_mutable_breaks ()
 
 PiecewiseTrajectory (const PiecewiseTrajectory &)=default
 
PiecewiseTrajectoryoperator= (const PiecewiseTrajectory &)=default
 
 PiecewiseTrajectory (PiecewiseTrajectory &&)=default
 
PiecewiseTrajectoryoperator= (PiecewiseTrajectory &&)=default
 
- Protected Member Functions inherited from Trajectory< T >
 Trajectory ()=default
 
 Trajectory (const Trajectory &)=default
 
Trajectoryoperator= (const Trajectory &)=default
 
 Trajectory (Trajectory &&)=default
 
Trajectoryoperator= (Trajectory &&)=default
 

Detailed Description

template<typename T>
class drake::trajectories::PiecewiseQuaternionSlerp< T >

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
T,double.

Constructor & Destructor Documentation

Builds an empty PiecewiseQuaternionSlerp.

PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const std::vector< Quaternion< T >> &  quaternions 
)

Builds a PiecewiseQuaternionSlerp.

Exceptions
std::logic_errorif breaks and quaternions have different length, or breaks have length < 2.
PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const std::vector< Matrix3< T >> &  rot_matrices 
)

Builds a PiecewiseQuaternionSlerp.

Exceptions
std::logic_errorif breaks and rot_matrices have different length, or breaks have length < 2.
PiecewiseQuaternionSlerp ( const std::vector< double > &  breaks,
const std::vector< AngleAxis< T >> &  ang_axes 
)

Builds a PiecewiseQuaternionSlerp.

Exceptions
std::logic_errorif breaks and ang_axes have different length, or breaks have length < 2.
~PiecewiseQuaternionSlerp ( )
overridedefault

Member Function Documentation

Vector3< T > 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< T > 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:

std::unique_ptr< Trajectory< T > > Clone ( ) const
overridevirtual
Returns
A deep copy of this Trajectory.

Implements Trajectory< T >.

Here is the call graph for this function:

Eigen::Index cols ( ) const
inlineoverridevirtual
Returns
The number of columns in the matrix returned by value().

Implements Trajectory< T >.

const std::vector<Quaternion<T> >& 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< T > &  other,
const T &  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:

std::unique_ptr< Trajectory< T > > MakeDerivative ( int  derivative_order = 1) const
overridevirtual
Exceptions
std::runtime_error(always) because it is not implemented yet.

Implements Trajectory< T >.

Here is the caller graph for this function:

PiecewiseQuaternionSlerp& operator= ( PiecewiseQuaternionSlerp< T > &&  )
default
PiecewiseQuaternionSlerp& operator= ( const PiecewiseQuaternionSlerp< T > &  )
default
Quaternion< T > 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
Returns
The number of rows in the matrix returned by value().

Implements Trajectory< T >.

MatrixX<T> value ( double  t) const
inlineoverridevirtual

Evaluates the trajectory at the given time t.

Parameters
tThe time at which to evaluate the trajectory.
Returns
The matrix of evaluated values.

Implements Trajectory< T >.


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