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>
|
| 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...
|
|
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;
traj.pos(0.3);
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
-
traj | The ROS message as the trajectory |
- Exceptions
-
In | case 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
-
time | The vector for all the time points |
pos | A matrix with rows the position points and a column for each joint. |
vel | A matrix with rows the velocity points and a column for each joint. |
acc | A matrix with rows the acceleration points and a column for each joint. |
arl::primitive::JointTrajectory::~JointTrajectory |
( |
| ) |
|
arma::vec arl::primitive::JointTrajectory::acc |
( |
double |
t | ) |
|
Returns the accelerations of the joints for the given time.
- Parameters
-
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
-
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_factor | The scale factor |
void arl::primitive::JointTrajectory::scaleDuration |
( |
double |
duration | ) |
|
Scales the trajectory and changes its duration to match the given one.
- Parameters
-
duration | The desired final duration. |
arma::vec arl::primitive::JointTrajectory::vel |
( |
double |
t | ) |
|
Returns the velocities of the joints for the given time.
- Parameters
-
std::ostream& operator<< |
( |
std::ostream & |
s, |
|
|
const JointTrajectory & |
joint_trajectory |
|
) |
| |
|
friend |