|
|
@@ -15,16 +15,36 @@ class Vehicle:
|
|
|
return hash(self.name)
|
|
|
|
|
|
|
|
|
+# Default vehicles configuration
|
|
|
+DEFAULT_VEHICLES = [
|
|
|
+ Vehicle(name="Copter", waf_build_command="copter"),
|
|
|
+ Vehicle(name="Plane", waf_build_command="plane"),
|
|
|
+ Vehicle(name="Rover", waf_build_command="rover"),
|
|
|
+ Vehicle(name="Sub", waf_build_command="sub"),
|
|
|
+ Vehicle(name="Heli", waf_build_command="heli"),
|
|
|
+ Vehicle(name="Blimp", waf_build_command="blimp"),
|
|
|
+ Vehicle(name="Tracker", waf_build_command="antennatracker"),
|
|
|
+ Vehicle(name="AP_Periph", waf_build_command="AP_Periph"),
|
|
|
+]
|
|
|
+
|
|
|
+
|
|
|
class VehiclesManager:
|
|
|
__singleton = None
|
|
|
|
|
|
- def __init__(self) -> None:
|
|
|
+ def __init__(self, vehicles: list = DEFAULT_VEHICLES) -> None:
|
|
|
+ """
|
|
|
+ Initialize VehiclesManager with a list of vehicles.
|
|
|
+
|
|
|
+ Args:
|
|
|
+ vehicles: List of Vehicle objects. Defaults to DEFAULT_VEHICLES.
|
|
|
+ """
|
|
|
# Enforce singleton pattern by raising an error if
|
|
|
# an instance already exists.
|
|
|
if VehiclesManager.__singleton:
|
|
|
raise RuntimeError("VehiclesManager must be a singleton.")
|
|
|
|
|
|
- self.vehicles = set()
|
|
|
+ self.vehicles = set(vehicles)
|
|
|
+
|
|
|
VehiclesManager.__singleton = self
|
|
|
|
|
|
def get_all_vehicle_names_sorted(self) -> list:
|