@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()); }
@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()); }