AUTh-ARL Core Stack  0.7
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
arl::primitive::JointTrajectory Class Reference

Stores a Robot Joint Trajectory, providing interfaces with Armadillo or ROS msgs. You can provide the class with several points and it will interpolate returning position, velocity, acceleration in any given time. More...

#include <joint_trajectory.h>

Public Member Functions

 JointTrajectory ()
 
 JointTrajectory (const trajectory_msgs::JointTrajectory &traj)
 Initializes the class with the points given by a ROS msg. More...
 
 JointTrajectory (const arma::vec &time, const arma::mat &pos, const arma::mat &vel, const arma::mat &acc)
 Initializes the class with the points given by armadillo matrices. More...
 
 ~JointTrajectory ()
 
void scale (double scale_factor)
 Scales the trajectory given a factor, by multiplying time with this factor, velocity with 1/factor and acceleration with 1/factor^2. More...
 
void scaleDuration (double duration)
 Scales the trajectory and changes its duration to match the given one. More...
 
double duration ()
 Returns the duration of the trajectory. More...
 
arma::vec pos (double t)
 Returns the positions of the joints for the given time. More...
 
arma::vec vel (double t)
 Returns the velocities of the joints for the given time. More...
 
arma::vec acc (double t)
 Returns the accelerations of the joints for the given time. More...
 

Friends

std::ostream & operator<< (std::ostream &, const JointTrajectory &)
 

Detailed Description

Stores a Robot Joint Trajectory, providing interfaces with Armadillo or ROS msgs. You can provide the class with several points and it will interpolate returning position, velocity, acceleration in any given time.

Example of use:

#include <autharl_core/primitive/joint_trajectory.h>
// ...
trajectory_msgs::JointTrajectory ros_msg;
// Fill in the ros msg...
JointTrajectory traj(ros_msg);
// Get the desired position in t = 0.3;
traj.pos(0.3);

Constructor & Destructor Documentation

arl::primitive::JointTrajectory::JointTrajectory ( )
inline
arl::primitive::JointTrajectory::JointTrajectory ( const trajectory_msgs::JointTrajectory &  traj)

Initializes the class with the points given by a ROS msg.

The ROS message should include joint names and points with position, velocity, accelarate at time steps given by time_from_start. See here: http://docs.ros.org/api/trajectory_msgs/html/msg/JointTrajectory.html

Parameters
trajThe ROS message as the trajectory
Exceptions
Incase the number of points or the number of joints are zero.
arl::primitive::JointTrajectory::JointTrajectory ( const arma::vec &  time,
const arma::mat &  pos,
const arma::mat &  vel,
const arma::mat &  acc 
)

Initializes the class with the points given by armadillo matrices.

You need to provide position, velocity and accelaration values for different time points.

Parameters
timeThe vector for all the time points
posA matrix with rows the position points and a column for each joint.
velA matrix with rows the velocity points and a column for each joint.
accA matrix with rows the acceleration points and a column for each joint.

Here is the call graph for this function:

arl::primitive::JointTrajectory::~JointTrajectory ( )

Member Function Documentation

arma::vec arl::primitive::JointTrajectory::acc ( double  t)

Returns the accelerations of the joints for the given time.

Parameters
Thedesired time

Here is the call graph for this function:

double arl::primitive::JointTrajectory::duration ( )

Returns the duration of the trajectory.

arma::vec arl::primitive::JointTrajectory::pos ( double  t)

Returns the positions of the joints for the given time.

Parameters
Thedesired time

Here is the call graph for this function:

void arl::primitive::JointTrajectory::scale ( double  scale_factor)

Scales the trajectory given a factor, by multiplying time with this factor, velocity with 1/factor and acceleration with 1/factor^2.

Parameters
scale_factorThe scale factor
void arl::primitive::JointTrajectory::scaleDuration ( double  duration)

Scales the trajectory and changes its duration to match the given one.

Parameters
durationThe desired final duration.

Here is the call graph for this function:

arma::vec arl::primitive::JointTrajectory::vel ( double  t)

Returns the velocities of the joints for the given time.

Parameters
Thedesired time

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const JointTrajectory joint_trajectory 
)
friend