diff --git a/aerpaw/client/uav.py b/aerpaw/client/uav.py index 90c7e93..61f07da 100755 --- a/aerpaw/client/uav.py +++ b/aerpaw/client/uav.py @@ -170,7 +170,8 @@ async def run_uav_client(client_id: int): # Load configuration origin_path = CONFIG_DIR / "origin.txt" - connection_path = CONFIG_DIR / "connection.txt" + connection_testbed_path = CONFIG_DIR / "connection_testbed.txt" + connection_local_path = CONFIG_DIR / "connection.txt" server_testbed_path = CONFIG_DIR / "server_testbed.txt" server_local_path = CONFIG_DIR / "server.txt" @@ -178,11 +179,18 @@ async def run_uav_client(client_id: int): origin_lat, origin_lon, origin_alt = load_origin(origin_path) print(f"UAV {client_id}: Origin: lat={origin_lat}, lon={origin_lon}, alt={origin_alt}") - print(f"UAV {client_id}: Loading connection from {connection_path}") - conn_str = load_connection(connection_path) + # Load both connection configs + testbed_conn = load_connection(connection_testbed_path) + local_conn = load_connection(connection_local_path) + + # Try testbed flight controller first (AERPAW MAVLink filter) + print(f"UAV {client_id}: Trying testbed flight controller: {testbed_conn}...") + drone = try_connect_drone(testbed_conn) + + if not drone: + print(f"UAV {client_id}: Testbed not available, trying local: {local_conn}...") + drone = try_connect_drone(local_conn) - # Auto-detect mode based on flight controller availability - drone = try_connect_drone(conn_str) real_mode = drone is not None if real_mode: diff --git a/aerpaw/config/connection_testbed.txt b/aerpaw/config/connection_testbed.txt new file mode 100644 index 0000000..4c4795d --- /dev/null +++ b/aerpaw/config/connection_testbed.txt @@ -0,0 +1,2 @@ +# AERPAW testbed - connect to MAVLink filter on E-VM +192.168.32.26:14550