use of org.openbot.vehicle.Control in project OpenBot by isl-org.
the class VehicleTest method getRotation.
@Test
public void getRotation() {
assertEquals(0, vehicle.getRotation(), 0.0);
vehicle.setControl(new Control(0.5f, 1));
assertEquals(-60, vehicle.getRotation(), 0.0);
vehicle.setControl(new Control(0f, 1));
assertEquals(-180, vehicle.getRotation(), 0.0);
}
use of org.openbot.vehicle.Control in project OpenBot by isl-org.
the class VehicleTest method getSpeed.
@Test
public void getSpeed() {
vehicle.setSpeedMultiplier(Enums.SpeedMode.SLOW.getValue());
vehicle.setControl(new Control(-1, -1));
assertEquals(-128, vehicle.getLeftSpeed(), 0.0);
assertEquals(-128, vehicle.getRightSpeed(), 0.0);
vehicle.setSpeedMultiplier(Enums.SpeedMode.NORMAL.getValue());
vehicle.setControl(new Control(-1, -1));
assertEquals(-192, vehicle.getLeftSpeed(), 0.0);
assertEquals(-192, vehicle.getRightSpeed(), 0.0);
vehicle.setSpeedMultiplier(Enums.SpeedMode.FAST.getValue());
vehicle.setControl(new Control(1, 1));
assertEquals(255, vehicle.getLeftSpeed(), 0.0);
assertEquals(255, vehicle.getRightSpeed(), 0.0);
}
Aggregations