AUTh-ARL Core Stack  0.7
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
arl::primitive::Trajectory< T > Class Template Reference

Represent a simple fifth order polynomial trajectory. Its a templated class that can be used with multiple types. More...

#include <trajectory.h>

Public Member Functions

 Trajectory ()
 
 ~Trajectory ()
 
void setParams (double t_init, const T &pos_init, const T &vel_init, const T &acc_init, double t_final, const T &pos_final, const T &vel_final, const T &acc_final)
 Calculates the parameters of the polynomial. More...
 
pos (double time)
 Calculates the position for the given time. More...
 
vel (double time)
 Calculates the velocity for the given time. More...
 
acc (double time)
 Calculates the acceleration for the given time. More...
 

Detailed Description

template<class T>
class arl::primitive::Trajectory< T >

Represent a simple fifth order polynomial trajectory. Its a templated class that can be used with multiple types.

The equations which are implemented here are described in book Robotics, Zoe Doulgeri, page 154.

Example of use:

#include <autharl_core/primitive/trajectory.h>
//...
Trajectory<double> t;
t.setParams(0, 1, 1, 1, 10, 2, 2, 2);
double time = 5.0;
double position = t.pos(time);
double velocity = t.vel(time);
double acceleration = t.acc(time);

Usage with vectors:

#include <autharl_core/primitive/trajectory.h>
//...
Trajectory<arma::vec> t;
arma::vec pos_init = {1, 0, 2};
arma::vec vel_init = {1, 0, 2};
arma::vec acc_init = {1, 0, 2};
arma::vec pos_final = {4, 7, 9};
arma::vec vel_final = {4, 7, 9};
arma::vec acc_final = {4, 7, 9};
// From initial time 10 to final 20
t.setParams(10, pos_init, vel_init, acc_init,
20, pos_final, vel_final, acc_final);
double time = 15.0;
arma::vec position = t.pos(time);
arma::vec velocity = t.vel(time);
arma::vec acceleration = t.acc(time);

Constructor & Destructor Documentation

template<class T>
arl::primitive::Trajectory< T >::Trajectory ( )
inline
template<class T>
arl::primitive::Trajectory< T >::~Trajectory ( )
inline

Member Function Documentation

template<class T>
T arl::primitive::Trajectory< T >::acc ( double  time)
inline

Calculates the acceleration for the given time.

Parameters
timeThe desired time
Returns
The acceleration in the desired time
template<class T>
T arl::primitive::Trajectory< T >::pos ( double  time)
inline

Calculates the position for the given time.

Parameters
timeThe desired time
Returns
The position in the desired time
template<class T>
void arl::primitive::Trajectory< T >::setParams ( double  t_init,
const T &  pos_init,
const T &  vel_init,
const T &  acc_init,
double  t_final,
const T &  pos_final,
const T &  vel_final,
const T &  acc_final 
)
inline

Calculates the parameters of the polynomial.

Parameters
t_initThe initial time value
pos_initThe initial position
vel_initThe initial velocity
acc_initThe initial acceleration
t_finalThe final time value
pos_finalThe final position
vel_finalThe final velocity
acc_finalThe final acceleration
template<class T>
T arl::primitive::Trajectory< T >::vel ( double  time)
inline

Calculates the velocity for the given time.

Parameters
timeThe desired time
Returns
The velocity in the desired time