Changed AnalogPotentiometer to use angle specification and rail voltage.

Change-Id: I98f2c1c16726496a69c86174cdb870c74e05822c
This commit is contained in:
Colby Skeggs
2014-10-23 16:42:15 +00:00
parent 5893d28f39
commit 2ae8f40a58
5 changed files with 75 additions and 62 deletions

View File

@@ -29,7 +29,7 @@ public class AnalogPotentiometerTest extends AbstractComsSetup {
private FakePotentiometerSource potSource;
private AnalogPotentiometer pot;
private static final double DOUBLE_COMPARISON_DELTA = 1.0;
private static final double DOUBLE_COMPARISON_DELTA = 2.0;
/**
* @throws java.lang.Exception
@@ -38,7 +38,7 @@ public class AnalogPotentiometerTest extends AbstractComsSetup {
public void setUp() throws Exception {
analogIO = TestBench.getAnalogCrossConnectFixture();
potSource = new FakePotentiometerSource(analogIO.getOutput(), 360);
pot = new AnalogPotentiometer(analogIO.getInput(), 360.0/5.0, 0);
pot = new AnalogPotentiometer(analogIO.getInput(), 360.0, 0);
}
@@ -66,6 +66,7 @@ public class AnalogPotentiometerTest extends AbstractComsSetup {
public void testRangeValues(){
for(double i = 0.0; i < 360.0; i = i+1.0){
potSource.setAngle(i);
potSource.setMaxVoltage(ControllerPower.getVoltage5V());
Timer.delay(.02);
assertEquals(i, pot.get(), DOUBLE_COMPARISON_DELTA);
}