You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
1.8 KiB

#ifndef _TRAJECTORY_H_
#define _TRAJECTORY_H_
#include "vec.h"
// all types of trajectories
enum TrajectoryType {
TrajectoryDefault = 0,
TrajectoryJointLinear = 0,
TrajectoryCartLinear,
TrajectoryJointBangBang,
TrajectoryCartBangBang,
TrajectoryJointFivePoly,
TrajectoryCartFivePoly,
TrajectoryJointLSPB,
TrajectoryCartLSPB
};
enum MovementType
{
MovementJointBased= 0,
MovementCartBased
};
template <unsigned SIZE>
class Trajectory
{
public:
Trajectory (
unsigned int steps_,
float totalTime_,
Vec<float,SIZE> jointMovement
);
Trajectory(
unsigned int steps_,
float totalTime_,
Mat<float,4> cartStart,
Mat<float,4> cartEnd
);
~Trajectory();
unsigned int getSteps();
unsigned int getRemainingSteps();
unsigned int getCurrentStep();
enum MovementType getMovementType();
Vec<float,SIZE> getNextJointPos ();
Mat<float,4> getNextCartPos ();
Vec<float,SIZE> getJointPos (unsigned int step);
Mat<float,4> getCartPos (unsigned int step);
Vec<float,SIZE> getJointVelocity (unsigned int step);
Vec<float,SIZE> getJointAcceleration(unsigned int step);
struct trajectoryNode
{
Vec<float,SIZE> jointPos;
Mat<float,4> cartPos;
Vec<float,SIZE> velocity;
Vec<float,SIZE> acceleration;
};
protected:
static const unsigned int defaultSteps = 100;
unsigned int steps;
unsigned int currentStep;
float totalTime;
struct trajectoryNode* nodes;
enum MovementType movementType;
};
#endif