WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::math::ExponentialProfile< Distance, Input > Class Template Reference

A Exponential-shaped velocity profile. More...

#include <wpi/math/trajectory/ExponentialProfile.hpp>

Classes

class  ProfileTiming
 Profile timing. More...
class  Constraints
 Profile constraints. More...
class  State
 Profile state. More...

Public Types

using Distance_t = wpi::units::unit_t<Distance>
using Velocity
using Velocity_t = wpi::units::unit_t<Velocity>
using Acceleration
using Input_t = wpi::units::unit_t<Input>
using A_t = wpi::units::unit_t<wpi::units::inverse<wpi::units::seconds>>
using B_t
using KV = wpi::units::compound_unit<Input, wpi::units::inverse<Velocity>>
using kV_t = wpi::units::unit_t<KV>
using KA
using kA_t = wpi::units::unit_t<KA>

Public Member Functions

constexpr ExponentialProfile (Constraints constraints)
 Constructs a ExponentialProfile.
constexpr ExponentialProfile (const ExponentialProfile &)=default
constexpr ExponentialProfileoperator= (const ExponentialProfile &)=default
constexpr ExponentialProfile (ExponentialProfile &&)=default
constexpr ExponentialProfileoperator= (ExponentialProfile &&)=default
constexpr State Calculate (const wpi::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.
constexpr State 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.
constexpr wpi::units::second_t TimeLeftUntil (const State &current, const State &goal) const
 Calculates the time it will take for this profile to reach the goal state.
constexpr ProfileTiming 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.

Detailed Description

template<class Distance, class Input>
class wpi::math::ExponentialProfile< Distance, Input >

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:

ExponentialProfile::Constraints constraints{kMaxV, kV, kA};
State previousProfiledReference = {initialReference, 0_mps};
Profile constraints.
Definition ExponentialProfile.hpp:86

Run on update:

previousProfiledReference = profile.Calculate(timeSincePreviousUpdate,
previousProfiledReference, unprofiledReference);

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().

Member Typedef Documentation

◆ A_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::A_t = wpi::units::unit_t<wpi::units::inverse<wpi::units::seconds>>

◆ Acceleration

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::Acceleration
Initial value:
wpi::units::compound_unit<Velocity,
wpi::units::inverse<wpi::units::seconds>>
wpi::units::compound_unit< Distance, wpi::units::inverse< wpi::units::seconds > > Velocity
Definition TrapezoidProfile.hpp:49

◆ B_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::B_t
Initial value:
wpi::units::unit_t<
wpi::units::compound_unit<Acceleration, wpi::units::inverse<Input>>>

◆ Distance_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::Distance_t = wpi::units::unit_t<Distance>

◆ Input_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::Input_t = wpi::units::unit_t<Input>

◆ KA

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::KA
Initial value:
wpi::units::compound_unit<Input, wpi::units::inverse<Acceleration>>

◆ kA_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::kA_t = wpi::units::unit_t<KA>

◆ KV

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::KV = wpi::units::compound_unit<Input, wpi::units::inverse<Velocity>>

◆ kV_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::kV_t = wpi::units::unit_t<KV>

◆ Velocity

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::Velocity
Initial value:
wpi::units::compound_unit<Distance,
wpi::units::inverse<wpi::units::seconds>>

◆ Velocity_t

template<class Distance, class Input>
using wpi::math::ExponentialProfile< Distance, Input >::Velocity_t = wpi::units::unit_t<Velocity>

Constructor & Destructor Documentation

◆ ExponentialProfile() [1/3]

template<class Distance, class Input>
wpi::math::ExponentialProfile< Distance, Input >::ExponentialProfile ( Constraints constraints)
inlineexplicitconstexpr

Constructs a ExponentialProfile.

Parameters
constraintsThe constraints on the profile, like maximum input.

◆ ExponentialProfile() [2/3]

template<class Distance, class Input>
wpi::math::ExponentialProfile< Distance, Input >::ExponentialProfile ( const ExponentialProfile< Distance, Input > & )
constexprdefault

◆ ExponentialProfile() [3/3]

template<class Distance, class Input>
wpi::math::ExponentialProfile< Distance, Input >::ExponentialProfile ( ExponentialProfile< Distance, Input > && )
constexprdefault

Member Function Documentation

◆ Calculate()

template<class Distance, class Input>
State wpi::math::ExponentialProfile< Distance, Input >::Calculate ( const wpi::units::second_t & t,
const State & current,
const State & goal ) const
inlineconstexpr

Calculates the position and velocity for the profile at a time t where the current state is at time t = 0.

Parameters
tHow long to advance from the current state toward the desired state.
currentThe current state.
goalThe desired state when the profile is complete.
Returns
The position and velocity of the profile at time t.

◆ CalculateInflectionPoint()

template<class Distance, class Input>
State wpi::math::ExponentialProfile< Distance, Input >::CalculateInflectionPoint ( const State & current,
const State & goal ) const
inlineconstexpr

Calculates the point after which the fastest way to reach the goal state is to apply input in the opposite direction.

Parameters
currentThe current state.
goalThe desired state when the profile is complete.
Returns
The position and velocity of the profile at the inflection point.

◆ CalculateProfileTiming()

template<class Distance, class Input>
ProfileTiming wpi::math::ExponentialProfile< Distance, Input >::CalculateProfileTiming ( const State & current,
const State & goal ) const
inlineconstexpr

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.

Parameters
currentThe current state.
goalThe desired state when the profile is complete.
Returns
The timing information for this profile.

◆ operator=() [1/2]

template<class Distance, class Input>
ExponentialProfile & wpi::math::ExponentialProfile< Distance, Input >::operator= ( const ExponentialProfile< Distance, Input > & )
constexprdefault

◆ operator=() [2/2]

template<class Distance, class Input>
ExponentialProfile & wpi::math::ExponentialProfile< Distance, Input >::operator= ( ExponentialProfile< Distance, Input > && )
constexprdefault

◆ TimeLeftUntil()

template<class Distance, class Input>
wpi::units::second_t wpi::math::ExponentialProfile< Distance, Input >::TimeLeftUntil ( const State & current,
const State & goal ) const
inlineconstexpr

Calculates the time it will take for this profile to reach the goal state.

Parameters
currentThe current state.
goalThe desired state when the profile is complete.
Returns
The total duration of this profile.

The documentation for this class was generated from the following file: