Commit 54226c4b authored by Tobias Meuser's avatar Tobias Meuser Committed by Jose Ignacio Monreal Bailey
Browse files

Provide heading in DefaultVehicleInformationComponent

parent cdb43de3
...@@ -220,6 +220,11 @@ public class TraciSimulationController implements VehicleController, SimulationS ...@@ -220,6 +220,11 @@ public class TraciSimulationController implements VehicleController, SimulationS
} }
@Override @Override
public double getVehicleHeading(String pVehicleID) {
return _positons.get(pVehicleID).getHeading();
}
@Override
public Location getVehiclePosition(double pStep, String pVehicleID) { public Location getVehiclePosition(double pStep, String pVehicleID) {
if (pStep == _step) { if (pStep == _step) {
return getVehiclePosition(pVehicleID); return getVehiclePosition(pVehicleID);
......
...@@ -88,6 +88,32 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom ...@@ -88,6 +88,32 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
}); });
siSComponent.provide().nodeState(SiSTypes.HEADING, new SiSDataCallback<Double>() {
@Override
public Double getValue(INodeID pNodeID,
SiSProviderHandle pProviderHandle)
throws InformationNotAvailableException {
if (pNodeID == getHost().getId()) {
if (isValid()) {
return controller.getVehicleHeading(vehicleID);
}
}
return null;
}
@Override
public Set<INodeID> getObservedNodes() {
return INodeID.getSingleIDSet(getHost().getId());
}
@Override
public SiSInfoProperties getInfoProperties() {
return new SiSInfoProperties();
}
});
if (pRouteKnown) { if (pRouteKnown) {
siSComponent.provide().nodeState(SiSTypes.ROUTE, new SiSDataCallback<RoadNetworkRoute>() { siSComponent.provide().nodeState(SiSTypes.ROUTE, new SiSDataCallback<RoadNetworkRoute>() {
......
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