Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
FunctionHandleTrajectory< T > Class Template Referencefinal

Detailed Description

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

FunctionHandleTrajectory takes a function, value = f(t), and provides a Trajectory interface.

Template Parameters
TThe scalar type, which must be one of the default scalars.

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

Public Member Functions

 FunctionHandleTrajectory (std::function< MatrixX< T >(const T &)> func, int rows, int cols=1, double start_time=-std::numeric_limits< double >::infinity(), double end_time=std::numeric_limits< double >::infinity())
 Creates the FunctionHandleTrajectory.
 ~FunctionHandleTrajectory () final
void set_derivative (std::function< MatrixX< T >(const T &, int)> func)
 Sets a callback function that returns the derivative of the function.
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 FunctionHandleTrajectory (const FunctionHandleTrajectory &)=default
FunctionHandleTrajectoryoperator= (const FunctionHandleTrajectory &)=default
 FunctionHandleTrajectory (FunctionHandleTrajectory &&)=default
FunctionHandleTrajectoryoperator= (FunctionHandleTrajectory &&)=default
Public Member Functions inherited from Trajectory< T >
virtual ~Trajectory ()
std::unique_ptr< Trajectory< T > > Clone () const
MatrixX< T > value (const T &t) const
 Evaluates the trajectory at the given time t.
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.
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.
bool has_derivative () const
 Returns true iff the Trajectory provides and implementation for EvalDerivative() and MakeDerivative().
MatrixX< T > EvalDerivative (const T &t, int derivative_order=1) const
 Evaluates the derivative of this at the given time t.
std::unique_ptr< Trajectory< T > > MakeDerivative (int derivative_order=1) const
 Takes the derivative of this Trajectory.
Eigen::Index rows () const
Eigen::Index cols () const
start_time () const
end_time () const

Additional Inherited Members

Protected Member Functions inherited from Trajectory< T >
 Trajectory ()=default
 Trajectory (const Trajectory &)=default
Trajectoryoperator= (const Trajectory &)=default
 Trajectory (Trajectory &&)=default
Trajectoryoperator= (Trajectory &&)=default

Constructor & Destructor Documentation

◆ FunctionHandleTrajectory() [1/3]

template<typename T>
FunctionHandleTrajectory ( const FunctionHandleTrajectory< T > & )
default

◆ FunctionHandleTrajectory() [2/3]

template<typename T>
FunctionHandleTrajectory ( FunctionHandleTrajectory< T > && )
default

◆ FunctionHandleTrajectory() [3/3]

template<typename T>
FunctionHandleTrajectory ( std::function< MatrixX< T >(const T &)> func,
int rows,
int cols = 1,
double start_time = -std::numeric_limits< double >::infinity(),
double end_time = std::numeric_limits< double >::infinity() )

Creates the FunctionHandleTrajectory.

By default the created trajectory does not provide derivatives. If trajectory derivatives are required, call set_derivative to provide the function's derivatives.

Parameters
funcThe function to be used to evaluate the trajectory.
rowsThe number of rows in the output of the function.
colsThe number of columns in the output of the function.
start_timeThe start time of the trajectory.
end_timeThe end time of the trajectory.
Exceptions
std::exceptionif func == nullptr, rows < 0, cols < 0, start_time > end_time, or if the function returns a matrix of the wrong size.

◆ ~FunctionHandleTrajectory()

template<typename T>
~FunctionHandleTrajectory ( )
final

Member Function Documentation

◆ operator=() [1/2]

template<typename T>
FunctionHandleTrajectory & operator= ( const FunctionHandleTrajectory< T > & )
default

◆ operator=() [2/2]

template<typename T>
FunctionHandleTrajectory & operator= ( FunctionHandleTrajectory< T > && )
default

◆ set_derivative()

template<typename T>
void set_derivative ( std::function< MatrixX< T >(const T &, int)> func)

Sets a callback function that returns the derivative of the function.

func(t,order) will only be called with order > 0. It is recommended that if the derivatives are not implemented for the requested order, the callback should throw an exception.

The size of the output of func will be checked each time the derivative is evaluated, and a std::exception will be thrown if the size is incorrect.


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