#include <TrapezoidalVelocityTrajectory.h>
Public Member Functions | |
double | a (double t) const |
bool | calculateMaxVel () |
Helper function to calculate the max velocity ____________ /| v1 | \ ./ | | \. | |
void | calculateTimeHelper () |
Helper function to calculate times (t1, t2, t3) | |
double | duration (double vmax_in, double amax_in, bool spline=true) |
Calculate the minimum duration trajectory given the constraints and max velocity and acceleration. | |
void | getTimes (double &t1_out, double &t2_out, double &t3_out) const |
Get the times of the trajectory profile ____________ /| | \ ./ | | \. t1 t2 t3. | |
double | p (double t) const |
void | setConstraints (double posInit_in, double posFinal_in, double velInit_in=0., double velFinal_in=0., double accelInit_in=0., double accelFinal_in=0.) |
void | setDuration (double duration_in) |
Set the trajectory duration to a specific value. | |
void | setDurationHelper (double duration_in) |
Helper calculation for setting the duration. | |
void | setTimes (double t1_in, double t2_in, double t3_in) |
set the times for the trajectory profile ____________ /| | \ ./ | | \. t1 t2 t3 | |
bool | timesValid () |
Function to tell whether times calculated are valid. | |
TrapezoidalVelocityUtility () | |
double | v (double t) const |
~TrapezoidalVelocityUtility () | |
Private Attributes | |
double | a1 |
double | a2 |
double | accelFinal |
double | accelInit |
double | accelMax |
double | posFinal |
double | posInit |
double | t1 |
double | t2 |
double | t3 |
double | timeMin |
double | v1 |
double | velFinal |
double | velInit |
double | velMax |
Definition at line 15 of file TrapezoidalVelocityTrajectory.h.
Definition at line 11 of file TrapezoidalVelocityTrajectory.cpp.
Definition at line 30 of file TrapezoidalVelocityTrajectory.cpp.
double TrapezoidalVelocityUtility::a | ( | double | t | ) | const |
Definition at line 468 of file TrapezoidalVelocityTrajectory.cpp.
Helper function to calculate the max velocity ____________ /| v1 | \ ./ | | \.
If an acceleration is zero, throw (protect from divide by zero)
Definition at line 402 of file TrapezoidalVelocityTrajectory.cpp.
Helper function to calculate times (t1, t2, t3)
if accelerations are zero, throw (protect from divide by zero)
Definition at line 366 of file TrapezoidalVelocityTrajectory.cpp.
double TrapezoidalVelocityUtility::duration | ( | double | vmax_in, |
double | amax_in, | ||
bool | spline = true |
||
) |
Calculate the minimum duration trajectory given the constraints and max velocity and acceleration.
std::runtime_error | if trajectory calculation fails |
if no movement required, set times equal to zero
if movement needed but no movement allowed by velocity, throw
if max acceleration 0, no movement possible, throw
final velocity too high, throw
If initial velocity above max, set the max velocity to initial
If moving in a positive direction, set velocity and first acceleration to positive
otherwise set velocity and first acceleration to negative
Definition at line 45 of file TrapezoidalVelocityTrajectory.cpp.
void TrapezoidalVelocityUtility::getTimes | ( | double & | t1_out, |
double & | t2_out, | ||
double & | t3_out | ||
) | const |
Get the times of the trajectory profile ____________ /| | \ ./ | | \. t1 t2 t3.
Definition at line 356 of file TrapezoidalVelocityTrajectory.cpp.
double TrapezoidalVelocityUtility::p | ( | double | t | ) | const |
get (p)osition, (v)elocity, and (a)cceleration at time t on the trajectory 0 <= t <= 1
Definition at line 436 of file TrapezoidalVelocityTrajectory.cpp.
void TrapezoidalVelocityUtility::setConstraints | ( | double | posInit_in, |
double | posFinal_in, | ||
double | velInit_in = 0. , |
||
double | velFinal_in = 0. , |
||
double | accelInit_in = 0. , |
||
double | accelFinal_in = 0. |
||
) |
Definition at line 35 of file TrapezoidalVelocityTrajectory.cpp.
void TrapezoidalVelocityUtility::setDuration | ( | double | duration_in | ) |
Set the trajectory duration to a specific value.
std::runtime_error | if setDuration calculation fails |
If no motion needed, set times to requested duration
If first time is <0, try to change first acceleration \ t1 t2\ \. t3
If second time is > than last time, try to change second acceleration .t3 / __________/ /t1 t2 ./
Require t1 <= t2 <= t3
If the position at time durationIn is greater than the requested position, then the requested duration/position is not achievable -- reject
Definition at line 207 of file TrapezoidalVelocityTrajectory.cpp.
void TrapezoidalVelocityUtility::setDurationHelper | ( | double | duration_in | ) |
Helper calculation for setting the duration.
If accelerations are near zero, throw (protect from divide by zero)
Definition at line 302 of file TrapezoidalVelocityTrajectory.cpp.
void TrapezoidalVelocityUtility::setTimes | ( | double | t1_in, |
double | t2_in, | ||
double | t3_in | ||
) |
set the times for the trajectory profile ____________ /| | \ ./ | | \. t1 t2 t3
Definition at line 484 of file TrapezoidalVelocityTrajectory.cpp.
Function to tell whether times calculated are valid.
Definition at line 198 of file TrapezoidalVelocityTrajectory.cpp.
double TrapezoidalVelocityUtility::v | ( | double | t | ) | const |
Definition at line 452 of file TrapezoidalVelocityTrajectory.cpp.
double TrapezoidalVelocityUtility::a1 [private] |
Definition at line 70 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::a2 [private] |
Definition at line 70 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::accelFinal [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::accelInit [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::accelMax [private] |
Definition at line 71 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::posFinal [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::posInit [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::t1 [private] |
Definition at line 69 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::t2 [private] |
Definition at line 69 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::t3 [private] |
Definition at line 69 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::timeMin [private] |
Definition at line 71 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::v1 [private] |
Definition at line 70 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::velFinal [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::velInit [private] |
Definition at line 68 of file TrapezoidalVelocityTrajectory.h.
double TrapezoidalVelocityUtility::velMax [private] |
Definition at line 71 of file TrapezoidalVelocityTrajectory.h.