@Test public void testConverTicksToDistance() { double conversion = 100; // units of ticks per length SimulatedEncoder simulatedEncoder = new SimulatedEncoder(conversion); int ticks = 100; assertEquals(1.0, simulatedEncoder.converTicksToDistance(ticks)); }
@Test public void testGetTicksFour() { double ticksPerPosition = 10.0; // units of conversion per count SimulatedEncoder simulatedEncoder = new SimulatedEncoder(ticksPerPosition); double jointPosition = 0.5; int expecetedTicks = 5; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expecetedTicks, simulatedEncoder.getEncoderTicks()); }
@Test public void testGetPositionFromEncoderFour() { double conversion = 100; // units of ticks per length SimulatedEncoder simulatedEncoder = new SimulatedEncoder(conversion); double jointPosition = 5.0; double expectedPosition = 5.0; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expectedPosition, simulatedEncoder.getPositionFromEncoder()); }
@Test public void testGetPositionFromEncoderTwo() { double conversion = 10; // units of ticks per length SimulatedEncoder simulatedEncoder = new SimulatedEncoder(conversion); double jointPosition = 4.0; int expecetedTicks = 40; double expectedPosition = expecetedTicks / conversion; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expectedPosition, simulatedEncoder.getPositionFromEncoder()); }
@Test public void testGetTicksThree() { double conversion = 0.5; // units of ticks per length SimulatedEncoder simulatedEncoder = new SimulatedEncoder(conversion); double jointPosition = 0.9; int expecetedTicks = 0; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expecetedTicks, simulatedEncoder.getEncoderTicks()); jointPosition = 1.1; expecetedTicks = 1; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expecetedTicks, simulatedEncoder.getEncoderTicks()); }
@Test public void testGetTicksTwo() { double conversion = 0.5; // units of conversion per count SimulatedEncoder simulatedEncoder = new SimulatedEncoder(conversion); double jointPosition = 50.0; int expecetedTicks = 25; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expecetedTicks, simulatedEncoder.getEncoderTicks()); jointPosition = 0.0; expecetedTicks = 0; simulatedEncoder.setActualPosition(jointPosition); assertEquals(expecetedTicks, simulatedEncoder.getEncoderTicks()); }