drone_cab.drone

Drone class.

This class implements the drones that transport packages from the corresponding pickup point to the destination residences.

Classes

Drone(pickup_id[, drone_capacity, ...])

Drones that carry packages from their pickup points to the destination residences.

class drone_cab.drone.Drone(pickup_id: str, drone_capacity: int = 2, drone_speed: float = 2.0, drone_range: float = 500.0)

Drones that carry packages from their pickup points to the destination residences.

Parameters:
  • pickup_id (str) – SUMO ID of the pickup point on which this drone sits.

  • drone_capacity (optional) – Maximum number of packages that this drone can carry. Defaults to tunable constant.

  • drone_speed (optional) – Maximum flying speed of this drone. Defaults to tunable constant.

  • drone_range (optional) – Maximum flying range of this drone. Defaults to tunable constant.

pickup_id

SUMO ID of the pickup point on which this drone sits.

center

2-D coordinates of the center of the pickup point polyon on which this drone sits.

capacity

Maximum number of packages that this drone can carry.

speed

Maximum flying speed of this drone.

range

float = drone_range #: Maximum flying range of this drone.

parked

True if drone is currently sitting idle at the pickup point.

distance_travelled

Total flying distance covered by the drone so far.

distance_travelled_per_flight

Flying distance covered by the drone in the current TSP route so far.

idle_steps

Number of idle time steps spent by this drone sitting parked at the pickup point.

route

Iterator over ordered list of target objects that comprises a full TSP route for this drone.

current_target

Destination residences (package objects) or pickup point (drone object) target that this drone is supposed to fly towards.

current_position

2-D coordinates of the current position of this drone.

carrying_package_set

Set of packages currently being carried by this drone.

__init__(pickup_id: str, drone_capacity: int = 2, drone_speed: float = 2.0, drone_range: float = 500.0) None
Parameters:
  • pickup_id (str)

  • drone_capacity (int)

  • drone_speed (float)

  • drone_range (float)

Return type:

None

assign_package(package: Package) None

Assign a package to this drone for being transported to its destination residence.

Parameters:

package (Package) – Package object to assign to this drone.

Return type:

None

christofides_route() list[Drone | Package]

Find the drone route to follow as per Christofides approximation of TSP.

Note

Start and end coordinates of the TSP route will be the center of the drone’s pickup point.

Return type:

list[Drone | Package]

drop_package(package: Package) None

Drop off a package being cuurently carried by this drone at its destination residence.

Parameters:

package (Package) – Package object to drop off at its destination residence from this drone.

Return type:

None

end_tsp() None

End the TSP route of the drone.

Return type:

None

fly_along_route()
start_tsp() None

Start the TSP route of the drone to start delivery of carrying_package_set.

Return type:

None

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)