Search in sources :

Example 6 with Control

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);
}
Also used : Control(org.openbot.vehicle.Control) Test(org.junit.Test)

Example 7 with Control

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);
}
Also used : Control(org.openbot.vehicle.Control) Test(org.junit.Test)

Aggregations

Control (org.openbot.vehicle.Control)7 Test (org.junit.Test)5 RectF (android.graphics.RectF)1 JSONObject (org.json.JSONObject)1