mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Clean up PIDController interface in preparation for ProfiledPIDController
This commit is contained in:
committed by
Peter Johnson
parent
fdc098267e
commit
fc98a79dbb
@@ -190,7 +190,7 @@ public class MotorEncoderTest extends AbstractComsSetup {
|
||||
|
||||
assertTrue(
|
||||
"PID loop did not reach reference within 10 seconds. The current error was" + pidController
|
||||
.getError(), pidController.atSetpoint());
|
||||
.getPositionError(), pidController.atSetpoint());
|
||||
|
||||
pidController.close();
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public class MotorEncoderTest extends AbstractComsSetup {
|
||||
pidRunner.stop();
|
||||
|
||||
assertTrue("PID loop did not reach reference within 10 seconds. The error was: " + pidController
|
||||
.getError(), pidController.atSetpoint());
|
||||
.getPositionError(), pidController.atSetpoint());
|
||||
|
||||
pidController.close();
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ public class PIDTest extends AbstractComsSetup {
|
||||
setupOutputRange();
|
||||
double reference = 2500.0;
|
||||
m_controller.setSetpoint(reference);
|
||||
assertEquals("PID.getError() did not start at " + reference, reference, m_controller.getError(),
|
||||
0);
|
||||
assertEquals("PID.getPositionError() did not start at " + reference,
|
||||
reference, m_controller.getPositionError(), 0);
|
||||
m_builder.updateTable();
|
||||
assertEquals(k_p, m_table.getEntry("Kp").getDouble(9999999), 0);
|
||||
assertEquals(k_i, m_table.getEntry("Ki").getDouble(9999999), 0);
|
||||
@@ -155,17 +155,17 @@ public class PIDTest extends AbstractComsSetup {
|
||||
setupAbsoluteTolerance();
|
||||
setupOutputRange();
|
||||
double reference = 1000.0;
|
||||
assertEquals(pidData() + "did not start at 0", 0, m_controller.getOutput(), 0);
|
||||
assertEquals(pidData() + "did not start at 0", 0, me.getMotor().get(), 0);
|
||||
m_controller.setSetpoint(reference);
|
||||
assertEquals(pidData() + "did not have an error of " + reference, reference,
|
||||
m_controller.getError(), 0);
|
||||
m_controller.getPositionError(), 0);
|
||||
Notifier pidRunner = new Notifier(
|
||||
() -> me.getMotor().set(m_controller.calculate(me.getEncoder().getDistance())));
|
||||
pidRunner.startPeriodic(m_controller.getPeriod());
|
||||
Timer.delay(5);
|
||||
pidRunner.stop();
|
||||
assertTrue(pidData() + "Was not on Target. Controller Error: " + m_controller.getError(),
|
||||
m_controller.atSetpoint());
|
||||
assertTrue(pidData() + "Was not on Target. Controller Error: "
|
||||
+ m_controller.getPositionError(), m_controller.atSetpoint());
|
||||
}
|
||||
|
||||
private String pidData() {
|
||||
|
||||
Reference in New Issue
Block a user