Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2024-12-26 18:55:43 -08:00
143 changed files with 6155 additions and 5268 deletions

View File

@@ -4,9 +4,6 @@
package edu.wpi.first.wpilibj.examples.elevatorexponentialsimulation.subsystems;
import static edu.wpi.first.units.Units.MetersPerSecond;
import static edu.wpi.first.units.Units.Volts;
import edu.wpi.first.math.controller.ElevatorFeedforward;
import edu.wpi.first.math.controller.PIDController;
import edu.wpi.first.math.system.plant.DCMotor;
@@ -114,9 +111,7 @@ public class Elevator implements AutoCloseable {
// With the setpoint value we run PID control like normal
double pidOutput = m_pidController.calculate(m_encoder.getDistance(), m_setpoint.position);
double feedforwardOutput =
m_feedforward
.calculate(MetersPerSecond.of(m_setpoint.velocity), MetersPerSecond.of(next.velocity))
.in(Volts);
m_feedforward.calculateWithVelocities(m_setpoint.velocity, next.velocity);
m_motor.setVoltage(pidOutput + feedforwardOutput);

View File

@@ -4,9 +4,6 @@
package edu.wpi.first.wpilibj.examples.elevatorprofiledpid;
import static edu.wpi.first.units.Units.MetersPerSecond;
import static edu.wpi.first.units.Units.Volts;
import edu.wpi.first.math.controller.ElevatorFeedforward;
import edu.wpi.first.math.controller.ProfiledPIDController;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
@@ -54,8 +51,6 @@ public class Robot extends TimedRobot {
// Run controller and update motor output
m_motor.setVoltage(
m_controller.calculate(m_encoder.getDistance())
+ m_feedforward
.calculate(MetersPerSecond.of(m_controller.getSetpoint().velocity))
.in(Volts));
+ m_feedforward.calculate(m_controller.getSetpoint().velocity));
}
}

View File

@@ -4,9 +4,6 @@
package edu.wpi.first.wpilibj.examples.elevatorsimulation.subsystems;
import static edu.wpi.first.units.Units.MetersPerSecond;
import static edu.wpi.first.units.Units.Volts;
import edu.wpi.first.math.controller.ElevatorFeedforward;
import edu.wpi.first.math.controller.ProfiledPIDController;
import edu.wpi.first.math.system.plant.DCMotor;
@@ -104,8 +101,7 @@ public class Elevator implements AutoCloseable {
// With the setpoint value we run PID control like normal
double pidOutput = m_controller.calculate(m_encoder.getDistance());
double feedforwardOutput =
m_feedforward.calculate(MetersPerSecond.of(m_controller.getSetpoint().velocity)).in(Volts);
double feedforwardOutput = m_feedforward.calculate(m_controller.getSetpoint().velocity);
m_motor.setVoltage(pidOutput + feedforwardOutput);
}