Trajectory objects provide derivatives by implementing DoEvalDerivative
and DoMakeDerivative
.
DoEvalDerivative
evaluates the derivative value at a point in time. DoMakeDerivative
returns a new Trajectory object which represents the derivative.
In some cases, it is easy to implement DoEvalDerivative
, but difficult or inefficient to implement DoMakeDerivative
natively. And it may be just as efficient to use DoEvalDerivative
even in repeated evaluations of the derivative. The DerivativeTrajectory class helps with this case – given a nominal
Trajectory, it provides a Trajectory interface that calls nominal.EvalDerivative()
to implement Trajectory::value()
.
T | The scalar type, which must be one of the default scalars. |
#include <drake/common/trajectories/derivative_trajectory.h>
Public Member Functions | |
DerivativeTrajectory (const Trajectory< T > &nominal, int derivative_order=1) | |
Creates a DerivativeTrajectory representing the derivative_order derivatives of nominal . More... | |
~DerivativeTrajectory () final | |
std::unique_ptr< Trajectory< T > > | Clone () const final |
MatrixX< T > | value (const T &t) const final |
Evaluates the trajectory at the given time t . More... | |
Eigen::Index | rows () const final |
Eigen::Index | cols () const final |
T | start_time () const final |
T | end_time () const final |
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable | |
DerivativeTrajectory (const DerivativeTrajectory &)=default | |
DerivativeTrajectory & | operator= (const DerivativeTrajectory &)=default |
DerivativeTrajectory (DerivativeTrajectory &&)=default | |
DerivativeTrajectory & | operator= (DerivativeTrajectory &&)=default |
Public Member Functions inherited from Trajectory< T > | |
virtual | ~Trajectory () |
MatrixX< T > | vector_values (const std::vector< T > &t) const |
If cols()==1, then evaluates the trajectory at each time t , and returns the results as a Matrix with the ith column corresponding to the ith time. More... | |
MatrixX< T > | vector_values (const Eigen::Ref< const VectorX< T >> &t) const |
If cols()==1, then evaluates the trajectory at each time t , and returns the results as a Matrix with the ith column corresponding to the ith time. More... | |
bool | has_derivative () const |
Returns true iff the Trajectory provides and implementation for EvalDerivative() and MakeDerivative(). More... | |
MatrixX< T > | EvalDerivative (const T &t, int derivative_order=1) const |
Evaluates the derivative of this at the given time t . More... | |
std::unique_ptr< Trajectory< T > > | MakeDerivative (int derivative_order=1) const |
Takes the derivative of this Trajectory. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Trajectory< T > | |
Trajectory ()=default | |
Trajectory (const Trajectory &)=default | |
Trajectory & | operator= (const Trajectory &)=default |
Trajectory (Trajectory &&)=default | |
Trajectory & | operator= (Trajectory &&)=default |
|
default |
|
default |
|
explicit |
Creates a DerivativeTrajectory representing the derivative_order
derivatives of nominal
.
This constructor makes a Clone() of nominal
and does not hold on to the reference.
std::exception | if !nominal.has_derivative() . |
std::exception | if derivative_order < 0. |
|
final |
|
finalvirtual |
Implements Trajectory< T >.
|
finalvirtual |
Implements Trajectory< T >.
|
finalvirtual |
Implements Trajectory< T >.
|
default |
|
default |
|
finalvirtual |
Implements Trajectory< T >.
|
finalvirtual |
Implements Trajectory< T >.
|
finalvirtual |
Evaluates the trajectory at the given time t
.
t | The time at which to evaluate the trajectory. |
Implements Trajectory< T >.