Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
|
Trapezoidal velocity profile in a single dimension. More...
#include <TrapezoidalVelocityProfile.h>
Public Member Functions | |
SingleDimTrapezoidalVelocityProfile (double maxVel, double maxAccel) | |
Construct a new velocity profile. | |
void | setTarget (robot::types::datatime_t currTime, double startPos, double endPos) |
Calculate a profile, assuming the mechanism begins and ends at rest. | |
bool | hasTarget () const |
Check if a profile has been calculated. | |
double | getCommand (robot::types::datatime_t currTime) const |
Get the target position. | |
void | reset () |
Reset the profile and clear any calculated profile. | |
std::optional< util::dseconds > | getTotalTime () const |
Get the total time it takes to perform the profile. | |
Trapezoidal velocity profile in a single dimension.
control::SingleDimTrapezoidalVelocityProfile::SingleDimTrapezoidalVelocityProfile | ( | double | maxVel, |
double | maxAccel ) |
Construct a new velocity profile.
maxVel | The maximum velocity the profile should attain. |
maxAccel | The maximum acceleration the profile should use. |
double control::SingleDimTrapezoidalVelocityProfile::getCommand | ( | robot::types::datatime_t | currTime | ) | const |
Get the target position.
currTime | The current timestamp. |
std::optional< util::dseconds > control::SingleDimTrapezoidalVelocityProfile::getTotalTime | ( | ) | const |
Get the total time it takes to perform the profile.
bool control::SingleDimTrapezoidalVelocityProfile::hasTarget | ( | ) | const |
Check if a profile has been calculated.
void control::SingleDimTrapezoidalVelocityProfile::setTarget | ( | robot::types::datatime_t | currTime, |
double | startPos, | ||
double | endPos ) |
Calculate a profile, assuming the mechanism begins and ends at rest.
currTime | The current timestamp. |
startPos | The position the profile starts at. |
endPos | The position the profile ends at. |