Class VehicleManager
java.lang.Object
real_time_traffic_simulation_with_java.wrapper.VehicleManager
Wrapper class for TraaS to manage vehicles in the simulation
-
Constructor Summary
ConstructorsConstructorDescriptionVehicleManager(it.polito.appeal.traci.SumoTraciConnection connection) Wrapper class for TraaS to manage vehicles in the simulation -
Method Summary
Modifier and TypeMethodDescriptionvoidInject a vehicle of default type into the simulation immediately if possible when called Generate a new route with a unique ID = vehicleID from start_edges to end_edges Set the color of the vehicle as user's choice, default to WHITE if invalid color string is givendoubleGet angle of a vehicle (degree), starting from the North (0 degree) and measured clockwisede.tudresden.sumo.objects.SumoColorGet color of a vehicleintgetCount()Get number of running vehicles, vehicles finished route or not yet be injected are not includedGet edge ID that the vehicle is currently on, including junction edgesGet list of filtered running vehicle IDs, vehicles finished route or not yet be injected are not includedGet list of running vehicle IDs, vehicles finished route or not yet be injected are not includedGet lane ID that the vehicle is currently on, including junction lanesde.tudresden.sumo.objects.SumoPosition2DgetPosition(String vehicleID) Get position of a vehicle in Cartesian coordinatesdoubleGet speed of a vehicle (km/h)Create and get a List of VehicleData for all vehiclesvoidSet color of a vehiclevoidSet filter for vehicles (color, edge)
-
Constructor Details
-
VehicleManager
public VehicleManager(it.polito.appeal.traci.SumoTraciConnection connection) Wrapper class for TraaS to manage vehicles in the simulation- Parameters:
connection- connection to Sumo
-
-
Method Details
-
setFilter
-
getIDList
-
getFilteredIDList
-
getCount
public int getCount()Get number of running vehicles, vehicles finished route or not yet be injected are not included- Returns:
- an int number of running vehicles
-
getPosition
-
getLaneID
-
getEdgeID
-
getSpeed
Get speed of a vehicle (km/h)- Parameters:
vehicleID- ID of the vehicle- Returns:
- a double speed of the vehicle (km/h)
-
getAngle
Get angle of a vehicle (degree), starting from the North (0 degree) and measured clockwise- Parameters:
vehicleID- ID of the vehicle- Returns:
- a double angle of the vehicle (degree)
-
setColor
Set color of a vehicle- Parameters:
vehicleID- ID of the vehiclecolor- SumoColor object representing the color to be set
-
getColor
-
add
Inject a vehicle of default type into the simulation immediately if possible when called Generate a new route with a unique ID = vehicleID from start_edges to end_edges Set the color of the vehicle as user's choice, default to WHITE if invalid color string is given- Parameters:
vehID- ID of the vehiclerouteID- ID of the routecolor- String representing the color of the vehicle
-
getVehicleDataList
Create and get a List of VehicleData for all vehicles- Returns:
- a List of VehicleData for all vehicles
- Throws:
Exception
-