Commit 5540da20 authored by Tobias Meuser's avatar Tobias Meuser
Browse files

Added speed sensor

parent 3e8abc02
......@@ -36,5 +36,6 @@ public interface VehicleController {
void init();
double getVehicleSpeed(String pVehicleID);
void stopVehicle(String pVehicle);
}
......@@ -597,4 +597,13 @@ public class TraciSimulationController implements VehicleController, SimulationS
return angle;
}
@Override
public double getVehicleSpeed(String pVehicleID) {
SumoCommand speedCommand = Vehicle.getSpeed(pVehicleID);
Object object = requestObject(speedCommand);
System.out.println(object.getClass());
return (Double)object;
}
}
......@@ -204,4 +204,9 @@ public class XMLSimulationController implements VehicleController, SimulationSet
throw new UnsupportedOperationException("This method is not supported for " + getClass().getSimpleName());
}
@Override
public double getVehicleSpeed(String pVehicleID) {
throw new UnsupportedOperationException("This method is not supported for " + getClass().getSimpleName());
}
}
......@@ -110,4 +110,9 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
controller.stopVehicle(vehicleID);
}
@Override
public double getCurrentSpeed() {
return controller.getVehicleSpeed(vehicleID);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment