drone_cab.vehicle¶
Vehicle (or cab) class.
This class implements the vehicles / cabs that transport packages from the central warehouse to the drone pickup points.
Classes
|
Vehicles that carry packages from the warehouse to pickup points. |
- class drone_cab.vehicle.Vehicle(vehicle_id: str, vehicle_capacity: int = 2)¶
Vehicles that carry packages from the warehouse to pickup points.
- Parameters:
vehicle_id (str) – SUMO ID of vehicle.
vehicle_capacity (optional) – Maximum number of packages that this vehicle can carry. Defaults to tunable constant.
- id¶
SUMO ID of vehicle
- capacity¶
Maximum number of packages that this vehicle can carry
- carrying_package_set¶
Set of packages being carried by this vehicle
- __init__(vehicle_id: str, vehicle_capacity: int = 2) None¶
- Parameters:
vehicle_id (str)
vehicle_capacity (int)
- Return type:
None
- add_package(package: Package) None¶
Add a package to the vehicle for transporting to a pickup point.
- Parameters:
package (Package) – Package object to be added to vehicle.
- Raises:
AssertionError – If addition of package would exceed capacity of vehicle.
- Return type:
None
- check_reached_pickup()¶
- static create_vehicle_list() None¶
Populate vehicle object list with SUMO IDs from current simulation.
- Return type:
None
- drop_package(package: Package) None¶
Drop a package off onto its assigned pickup point.
- Parameters:
package (Package) – Package object to drop off.
- Raises:
AssertionError – If package has no assigned pickup point.
- Return type:
None
- get_distance_along_road(target: tuple[float, float]) float¶
Get distance along the road network to the specified target.
- Parameters:
target (tuple[float, float]) – 2-D coordinates of target to measure distance to.
- Returns:
Distance along the road network to the specified target.
- Return type:
float
- get_road_id() str¶
Get SUMO ID of road that vehicle is currently on.
- Returns:
SUMO ID of road that vehicle is currently on.
- Return type:
str
- get_route_edge_id_list() list[str]¶
Get list of SUMO IDs of edges that comprise vehicle’s route.
- Returns:
List of SUMO IDs of edges that comrpise vehcile’s route.
- Return type:
list[str]
- static get_vehicle_list() list[Vehicle]¶
Return vehicle object list with SUMO IDs from current simulation.
- Returns:
List of vehicle objects.
- Return type:
list[Vehicle]
- is_visiting_warehouse(warehouse: Warehouse) bool¶
Whether vehicle is yet to reach warehouse.
- Parameters:
warehouse (Warehouse) – SUMO ID of warehouse to visit for picking up packages.
- Returns:
True if vehicle has not yet reached edge closest to warehouse.
- Return type:
bool
- step(int) bool¶
After adding a StepListener ‘listener’ with traci.addStepListener(listener), TraCI will call listener.step(t) after each call to traci.simulationStep(t) The return value indicates whether the stepListener wants to stay active.
- Parameters:
t (int)