WPILibC++ 2024.3.2
|
A Exponential-shaped velocity profile. More...
#include <frc/trajectory/ExponentialProfile.h>
Classes | |
class | Constraints |
Profile constraints. More... | |
class | ProfileTiming |
Profile timing. More... | |
class | State |
Profile state. More... | |
Public Types | |
using | Distance_t = units::unit_t< Distance > |
using | Velocity = units::compound_unit< Distance, units::inverse< units::seconds > > |
using | Velocity_t = units::unit_t< Velocity > |
using | Acceleration = units::compound_unit< Velocity, units::inverse< units::seconds > > |
using | Input_t = units::unit_t< Input > |
using | A_t = units::unit_t< units::inverse< units::seconds > > |
using | B_t = units::unit_t< units::compound_unit< Acceleration, units::inverse< Input > > > |
using | KV = units::compound_unit< Input, units::inverse< Velocity > > |
using | kV_t = units::unit_t< KV > |
using | KA = units::compound_unit< Input, units::inverse< Acceleration > > |
using | kA_t = units::unit_t< KA > |
Public Member Functions | |
ExponentialProfile (Constraints constraints) | |
Constructs a ExponentialProfile. More... | |
ExponentialProfile (const ExponentialProfile &)=default | |
ExponentialProfile & | operator= (const ExponentialProfile &)=default |
ExponentialProfile (ExponentialProfile &&)=default | |
ExponentialProfile & | operator= (ExponentialProfile &&)=default |
State | Calculate (const units::second_t &t, const State ¤t, const State &goal) const |
Calculates the position and velocity for the profile at a time t where the current state is at time t = 0. More... | |
State | CalculateInflectionPoint (const State ¤t, const State &goal) const |
Calculates the point after which the fastest way to reach the goal state is to apply input in the opposite direction. More... | |
units::second_t | TimeLeftUntil (const State ¤t, const State &goal) const |
Calculates the time it will take for this profile to reach the goal state. More... | |
ProfileTiming | CalculateProfileTiming (const State ¤t, const State &goal) const |
Calculates the time it will take for this profile to reach the inflection point, and the time it will take for this profile to reach the goal state. More... | |
A Exponential-shaped velocity profile.
While this class can be used for a profiled movement from start to finish, the intended usage is to filter a reference's dynamics based on ExponentialProfile velocity constraints. To compute the reference obeying this constraint, do the following.
Initialization:
Run on update:
where unprofiledReference
is free to change between calls. Note that when the unprofiled reference is within the constraints, Calculate()
returns the unprofiled reference unchanged.
Otherwise, a timer can be started to provide monotonic values for Calculate()
and to determine when the profile has completed via IsFinished()
.
using frc::ExponentialProfile< Distance, Input >::A_t = units::unit_t<units::inverse<units::seconds> > |
using frc::ExponentialProfile< Distance, Input >::Acceleration = units::compound_unit<Velocity, units::inverse<units::seconds> > |
using frc::ExponentialProfile< Distance, Input >::B_t = units::unit_t<units::compound_unit<Acceleration, units::inverse<Input> >> |
using frc::ExponentialProfile< Distance, Input >::Distance_t = units::unit_t<Distance> |
using frc::ExponentialProfile< Distance, Input >::Input_t = units::unit_t<Input> |
using frc::ExponentialProfile< Distance, Input >::KA = units::compound_unit<Input, units::inverse<Acceleration> > |
using frc::ExponentialProfile< Distance, Input >::kA_t = units::unit_t<KA> |
using frc::ExponentialProfile< Distance, Input >::KV = units::compound_unit<Input, units::inverse<Velocity> > |
using frc::ExponentialProfile< Distance, Input >::kV_t = units::unit_t<KV> |
using frc::ExponentialProfile< Distance, Input >::Velocity = units::compound_unit<Distance, units::inverse<units::seconds> > |
using frc::ExponentialProfile< Distance, Input >::Velocity_t = units::unit_t<Velocity> |
|
explicit |
Constructs a ExponentialProfile.
constraints | The constraints on the profile, like maximum input. |
|
default |
|
default |
ExponentialProfile< Distance, Input >::State frc::ExponentialProfile< Distance, Input >::Calculate | ( | const units::second_t & | t, |
const State & | current, | ||
const State & | goal | ||
) | const |
Calculates the position and velocity for the profile at a time t where the current state is at time t = 0.
t | How long to advance from the current state toward the desired state. |
current | The current state. |
goal | The desired state when the profile is complete. |
ExponentialProfile< Distance, Input >::State frc::ExponentialProfile< Distance, Input >::CalculateInflectionPoint | ( | const State & | current, |
const State & | goal | ||
) | const |
Calculates the point after which the fastest way to reach the goal state is to apply input in the opposite direction.
current | The current state. |
goal | The desired state when the profile is complete. |
ExponentialProfile< Distance, Input >::ProfileTiming frc::ExponentialProfile< Distance, Input >::CalculateProfileTiming | ( | const State & | current, |
const State & | goal | ||
) | const |
Calculates the time it will take for this profile to reach the inflection point, and the time it will take for this profile to reach the goal state.
current | The current state. |
goal | The desired state when the profile is complete. |
|
default |
|
default |
units::second_t frc::ExponentialProfile< Distance, Input >::TimeLeftUntil | ( | const State & | current, |
const State & | goal | ||
) | const |
Calculates the time it will take for this profile to reach the goal state.
current | The current state. |
goal | The desired state when the profile is complete. |