44template <
class Distance>
118 "Pass the desired and current state into calculate instead of "
119 "constructing a new TrapezoidProfile with the desired and current "
140 "Pass the desired and current state into calculate instead of "
141 "constructing a new TrapezoidProfile with the desired and current "
170 units::second_t
TotalTime()
const {
return m_endDeccel; }
192 static bool ShouldFlipAcceleration(
const State& initial,
const State& goal) {
193 return initial.position > goal.position;
199 result.position *= m_direction;
200 result.velocity *= m_direction;
207 Constraints m_constraints;
212 units::second_t m_endAccel;
213 units::second_t m_endFullSpeed;
214 units::second_t m_endDeccel;
Profile constraints.
Definition: TrapezoidProfile.h:58
Constraints(Velocity_t maxVelocity, Acceleration_t maxAcceleration)
Constructs constraints for a Trapezoid Profile.
Definition: TrapezoidProfile.h:80
Constraints()
Default constructor.
Definition: TrapezoidProfile.h:69
Velocity_t maxVelocity
Maximum velocity.
Definition: TrapezoidProfile.h:61
Acceleration_t maxAcceleration
Maximum acceleration.
Definition: TrapezoidProfile.h:64
Profile state.
Definition: TrapezoidProfile.h:90
Velocity_t velocity
The velocity at this state.
Definition: TrapezoidProfile.h:96
bool operator==(const State &) const =default
Distance_t position
The position at this state.
Definition: TrapezoidProfile.h:93
A trapezoid-shaped velocity profile.
Definition: TrapezoidProfile.h:45
TrapezoidProfile & operator=(const TrapezoidProfile &)=default
TrapezoidProfile(Constraints constraints)
Constructs a TrapezoidProfile.
Definition: TrapezoidProfile.inc:14
units::compound_unit< Velocity, units::inverse< units::seconds > > Acceleration
Definition: TrapezoidProfile.h:52
units::compound_unit< Distance, units::inverse< units::seconds > > Velocity
Definition: TrapezoidProfile.h:49
TrapezoidProfile(const TrapezoidProfile &)=default
State Calculate(units::second_t t) const
Calculates the position and velocity for the profile at a time t where the current state is at time t...
Definition: TrapezoidProfile.inc:67
units::second_t TimeLeftUntil(Distance_t target) const
Returns the time left until a target distance in the profile is reached.
Definition: TrapezoidProfile.inc:171
units::second_t TotalTime() const
Returns the total time the profile takes to reach the goal.
Definition: TrapezoidProfile.h:170
bool IsFinished(units::second_t t) const
Returns true if the profile has reached the goal.
Definition: TrapezoidProfile.h:181
TrapezoidProfile & operator=(TrapezoidProfile &&)=default
units::unit_t< Velocity > Velocity_t
Definition: TrapezoidProfile.h:50
TrapezoidProfile(TrapezoidProfile &&)=default
static void ReportUsage(MathUsageId id, int count)
Definition: MathShared.h:73
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1434
constexpr auto in(type t, int set) -> bool
Definition: core.h:611
State
Possible state of a SysId routine.
Definition: SysIdRoutineLog.h:25
Definition: AprilTagPoseEstimator.h:15
@ kTrajectory_TrapezoidProfile