mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +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:
@@ -40,7 +40,7 @@ public class Robot extends 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(
|
||||
|
||||
@@ -126,7 +126,7 @@ public class Robot extends TimedRobot {
|
||||
goal = new TrapezoidProfile.State(kLoweredPosition, 0.0);
|
||||
}
|
||||
// Step our TrapezoidalProfile forward 20ms and set it as our next reference
|
||||
m_lastProfiledReference = m_profile.calculate(0.020, goal, m_lastProfiledReference);
|
||||
m_lastProfiledReference = m_profile.calculate(0.020, m_lastProfiledReference, goal);
|
||||
m_loop.setNextR(m_lastProfiledReference.position, m_lastProfiledReference.velocity);
|
||||
// Correct our Kalman filter's state vector estimate with encoder data.
|
||||
m_loop.correct(VecBuilder.fill(m_encoder.getDistance()));
|
||||
|
||||
@@ -130,7 +130,7 @@ public class Robot extends TimedRobot {
|
||||
goal = new TrapezoidProfile.State(kLowGoalPosition, 0.0);
|
||||
}
|
||||
// Step our TrapezoidalProfile forward 20ms and set it as our next reference
|
||||
m_lastProfiledReference = m_profile.calculate(0.020, goal, m_lastProfiledReference);
|
||||
m_lastProfiledReference = m_profile.calculate(0.020, m_lastProfiledReference, goal);
|
||||
m_loop.setNextR(m_lastProfiledReference.position, m_lastProfiledReference.velocity);
|
||||
|
||||
// Correct our Kalman filter's state vector estimate with encoder data.
|
||||
|
||||
Reference in New Issue
Block a user