@ContinuousIntegrationTest(estimatedDuration = 0.3) @Test(timeout=300000) public void testCompute_integral() { PIDController pid = new PIDController("", null); pid.setIntegralGain(4.0); double currentPosition = 0.0; double desiredPosition = 5.0; double currentRate = 0.0; double desiredRate = 3.0; assertEquals(2.0, pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); pid.setIntegralGain(8.0); assertEquals(8.0, pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); }
@ContinuousIntegrationTest(estimatedDuration = 0.2) @Test(timeout=300000) public void testSetIntegralGain() { YoVariableRegistry registry = new YoVariableRegistry("mike"); PIDController pid = new PIDController("", registry); pid.setIntegralGain(5.0); assertEquals(5.0, pid.getIntegralGain(), 0.001); }
public void setGains(PIDGainsReadOnly gains) { pdController.setGains(gains); setMaximumOutputLimit(gains.getMaximumFeedback()); setIntegralLeakRatio(gains.getIntegralLeakRatio()); setIntegralGain(gains.getKi()); setMaxIntegralError(gains.getMaxIntegralError()); }
pidController.setGains(gains); pidController.setProportionalGain(gains.getKp()); pidController.setIntegralGain(gains.getKi()); YoEffortJointHandleHolder handle = jointHandles.get(fingerMotorNameEnum);
jointPositionController.setIntegralGain(35.0 * subtreeMass); jointPositionController.setMaxIntegralError(0.3); jointPositionController.setIntegralLeakRatio(integralLeakRatio); jointVelocityController.setIntegralGain(35.0 * subtreeMass); jointVelocityController.setMaxIntegralError(0.3); jointVelocityController.setIntegralLeakRatio(integralLeakRatio); jointPositionController.setIntegralGain(9.0 * 50.0 * subtreeMass); jointPositionController.setMaxIntegralError(0.2); jointPositionController.setIntegralLeakRatio(integralLeakRatio); jointVelocityController.setIntegralGain(9.0 * 50.0 * subtreeMass); jointVelocityController.setMaxIntegralError(0.2); jointVelocityController.setIntegralLeakRatio(integralLeakRatio); jointPositionController.setIntegralGain(1000.0 * 50.0); jointPositionController.setMaxIntegralError(0.2); jointPositionController.setIntegralLeakRatio(integralLeakRatio); jointVelocityController.setIntegralGain(1000.0 * 50.0); jointVelocityController.setMaxIntegralError(0.2); jointVelocityController.setIntegralLeakRatio(integralLeakRatio); jointPositionController.setIntegralGain(6.0 * 50.0 * totalMass); jointPositionController.setMaxIntegralError(0.2); jointPositionController.setIntegralLeakRatio(integralLeakRatio); jointVelocityController.setIntegralGain(6.4 * 50.0 * totalMass);
jointController.setIntegralGain(35.0 * subtreeMass); jointController.setMaxIntegralError(0.3); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio);
jointController.setIntegralGain(35.0 * subtreeMass); jointController.setMaxIntegralError(0.3); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio); jointController.setIntegralGain(1000.0 * 50.0); jointController.setMaxIntegralError(0.2); jointController.setIntegralLeakRatio(integralLeakRatio);
@ContinuousIntegrationTest(estimatedDuration = 0.2) @Test(timeout=300000) public void testCompute_all_PID() { PIDController pid = new PIDController("", null); pid.setProportionalGain(2.0); pid.setIntegralGain(3.0); pid.setDerivativeGain(4.0); pid.setMaxIntegralError(10.0); double currentPosition = 0.0; double desiredPosition = 5.0; double currentRate = 0.0; double desiredRate = 2.0; assertEquals((10.0 + 1.5 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); assertEquals((10.0 + 3.0 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); assertEquals((10.0 + 18.0 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 1.0), 0.001); // tests max integration error assertEquals((10.0 + 30.0 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 1.01), 0.001); }
@ContinuousIntegrationTest(estimatedDuration = 0.3) @Test(timeout=300000) public void testCompute_all_PID_withDeadband() { PIDController pid = new PIDController("", null); pid.setProportionalGain(2.0); pid.setIntegralGain(3.0); pid.setDerivativeGain(4.0); pid.setMaxIntegralError(10.0); pid.setPositionDeadband(1.5); double currentPosition = 0.0; double desiredPosition = 5.0; double currentRate = 0.0; double desiredRate = 2.0; assertEquals((7.0 + 1.05 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); assertEquals((7.0 + 2.1 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 0.1), 0.001); assertEquals((7.0 + 12.6 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 1.0), 0.001); // tests max integration error assertEquals((7.0 + 30.0 + 8.0), pid.compute(currentPosition, desiredPosition, currentRate, desiredRate, 3.0), 0.001); }
jointPositionController.setIntegralGain(0.0); jointPositionController.setMaximumOutputLimit(Double.POSITIVE_INFINITY);
PIDController pid2 = new PIDController("2", registry); pid2.setProportionalGain(proportional); pid2.setIntegralGain(integral); pid2.setDerivativeGain(derivative); pid2.setMaxIntegralError(maxIntegral);