mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
PIDController class now uses LinearDigitalFilter for filtering velocity instead of internal queue (#38)
This commit is contained in:
committed by
Peter Johnson
parent
7f46b50b21
commit
4a07f0380f
@@ -77,15 +77,15 @@ public class PIDToleranceTest {
|
||||
m_pid.enable();
|
||||
Timer.delay(1);
|
||||
assertFalse("Error was in tolerance when it should not have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
m_inp.m_val = m_setPoint + m_tolerance / 2;
|
||||
Timer.delay(1.0);
|
||||
assertTrue("Error was not in tolerance when it should have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
m_inp.m_val = m_setPoint + 10 * m_tolerance;
|
||||
Timer.delay(1.0);
|
||||
assertFalse("Error was in tolerance when it should not have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -94,16 +94,16 @@ public class PIDToleranceTest {
|
||||
m_pid.setSetpoint(m_setPoint);
|
||||
m_pid.enable();
|
||||
assertFalse("Error was in tolerance when it should not have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
//half of percent tolerance away from setPoint
|
||||
m_inp.m_val = m_setPoint + m_tolerance / 200 * m_range;
|
||||
Timer.delay(1.0);
|
||||
assertTrue("Error was not in tolerance when it should have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
//double percent tolerance away from setPoint
|
||||
m_inp.m_val = m_setPoint + m_tolerance / 50 * m_range;
|
||||
Timer.delay(1.0);
|
||||
assertFalse("Error was in tolerance when it should not have been. Error was "
|
||||
+ m_pid.getAvgError(), m_pid.onTarget());
|
||||
+ m_pid.getError(), m_pid.onTarget());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user