MRSL Motion Primitive Library  1.2
A motion primitive library for generating trajectory for mobile robots
Public Member Functions | Public Attributes | List of all members
Trajectory< Dim > Class Template Reference

Trajectory class. More...

#include <trajectory.h>

Public Member Functions

 Trajectory ()
 Empty constructor.
 
 Trajectory (const vec_E< Primitive< Dim >> &prs)
 Construct from multiple primitives.
 
Waypoint< Dim > evaluate (decimal_t time) const
 Evaluate Waypoint at time $t$. More...
 
bool evaluate (decimal_t time, Command< Dim > &p) const
 Evaluate Command at $t$, return false if fails to evaluate. More...
 
bool scale (decimal_t ri, decimal_t rf)
 Scale according to ratio at start and end (velocity only)
 
bool scale_down (decimal_t mv, decimal_t ri, decimal_t rf)
 Scale down the whole trajectory according to mv.
 
vec_E< Command< Dim > > sample (int N) const
 Sample N+1 Command along trajectory using uniformed time.
 
decimal_t J (const Control::Control &control) const
 Return total efforts of Primitive for the given duration: $J(i) = \int_0^T |p^{i}(t)|^2dt$. More...
 
decimal_t Jyaw () const
 Return total yaw efforts for the given duration: $J_{yaw} = \int_0^T |\dot{\phi}(t)|^2dt$. More...
 
std::vector< decimal_tgetSegmentTimes () const
 Get time of each segment.
 
vec_E< Waypoint< Dim > > getWaypoints () const
 Get intermediate Waypoint on the trajectory.
 
vec_E< Primitive< Dim > > getPrimitives () const
 Get Primitive array.
 
Lambda lambda () const
 Get the scaling factor Lambda.
 
decimal_t getTotalTime () const
 Get the total duration of Trajectory.
 

Public Attributes

vec_E< Primitive< Dim > > segs
 Segments of primitives.
 
std::vector< decimal_ttaus
 Time in virtual domain.
 
std::vector< decimal_tTs
 Time in actual domain.
 
decimal_t total_t_
 Total time of the trajectory.
 
Lambda lambda_
 Scaling object.
 

Detailed Description

template<int Dim>
class Trajectory< Dim >

Trajectory class.

A trajectory is composed by multiple end-to-end connected primitives, so-called piece-wise polynomials

Member Function Documentation

◆ evaluate() [1/2]

template<int Dim>
Waypoint<Dim> Trajectory< Dim >::evaluate ( decimal_t  time) const
inline

Evaluate Waypoint at time $t$.

If t is out of scope, we set t to be the closer bound (0 or total_t_) and return the evaluation; The failure case is when lambda is ill-posed such that $t = \lambda(\tau)^{-1}$ has no solution, in which a null Waypoint is returned

◆ evaluate() [2/2]

template<int Dim>
bool Trajectory< Dim >::evaluate ( decimal_t  time,
Command< Dim > &  p 
) const
inline

Evaluate Command at $t$, return false if fails to evaluate.

If $t$ is out of scope, we set $t$ to be the closer bound (0 or total_t_) and return the evaluation; The failure case is when lambda is ill-posed such that $t = \lambda(\tau)^{-1}$ has no solution.

◆ J()

template<int Dim>
decimal_t Trajectory< Dim >::J ( const Control::Control control) const
inline

Return total efforts of Primitive for the given duration: $J(i) = \int_0^T |p^{i}(t)|^2dt$.

Parameters
controlFlag that indicates the order of derivative $i$

Return J is the summation of efforts in all three dimensions. Control::VEL or Control::VELxYAW corresponds to $i = 1$; Control::ACC or Control::ACCxYAW corresponds to $i = 2$; Control::JRK or Control::JRKxYAW corresponds to $i = 3$; Control::SNP or Control::SNPxYAW corresponds to $i = 4$.

◆ Jyaw()

template<int Dim>
decimal_t Trajectory< Dim >::Jyaw ( ) const
inline

Return total yaw efforts for the given duration: $J_{yaw} = \int_0^T |\dot{\phi}(t)|^2dt$.

By default, the Jyaw is using Control::VEL to calculate.


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