mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpimath] Reorder TrapezoidProfile.calculate() arguments (#5874)
ProfiledPIDController and ExponentialProfile use current, then goal. This isn't a breaking change because this overload of calculate() is new for 2024.
This commit is contained in:
@@ -34,7 +34,7 @@ class Robot : public frc::TimedRobot {
|
||||
|
||||
// Retrieve the profiled setpoint for the next timestep. This setpoint moves
|
||||
// toward the goal while obeying the constraints.
|
||||
m_setpoint = m_profile.Calculate(kDt, m_goal, m_setpoint);
|
||||
m_setpoint = m_profile.Calculate(kDt, m_setpoint, m_goal);
|
||||
|
||||
// Send setpoint to offboard controller PID
|
||||
m_motor.SetSetpoint(ExampleSmartMotorController::PIDMode::kPosition,
|
||||
|
||||
@@ -117,7 +117,7 @@ class Robot : public frc::TimedRobot {
|
||||
goal = {kLoweredPosition, 0_rad_per_s};
|
||||
}
|
||||
m_lastProfiledReference =
|
||||
m_profile.Calculate(20_ms, goal, m_lastProfiledReference);
|
||||
m_profile.Calculate(20_ms, m_lastProfiledReference, goal);
|
||||
|
||||
m_loop.SetNextR(frc::Vectord<2>{m_lastProfiledReference.position.value(),
|
||||
m_lastProfiledReference.velocity.value()});
|
||||
|
||||
@@ -117,7 +117,7 @@ class Robot : public frc::TimedRobot {
|
||||
goal = {kLoweredPosition, 0_fps};
|
||||
}
|
||||
m_lastProfiledReference =
|
||||
m_profile.Calculate(20_ms, goal, m_lastProfiledReference);
|
||||
m_profile.Calculate(20_ms, m_lastProfiledReference, goal);
|
||||
|
||||
m_loop.SetNextR(frc::Vectord<2>{m_lastProfiledReference.position.value(),
|
||||
m_lastProfiledReference.velocity.value()});
|
||||
|
||||
Reference in New Issue
Block a user