From 3ae8c1285fe4b4926150d4be5590cac87395f7da Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 12 Oct 2024 21:54:02 +1100 Subject: [PATCH] MAVProxy: add compatibility code for MAV_TYPE_VTOL_DUOROTOR rename to MAV_TYPE_VTOL_TAILSITTER_DUOROTOR --- MAVProxy/modules/mavproxy_link.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/MAVProxy/modules/mavproxy_link.py b/MAVProxy/modules/mavproxy_link.py index 1d5b1c5102..f28c5bbc2c 100644 --- a/MAVProxy/modules/mavproxy_link.py +++ b/MAVProxy/modules/mavproxy_link.py @@ -675,6 +675,19 @@ def heartbeat_is_from_autopilot(self, m): return True + mav_type_planes = [ + mavutil.mavlink.MAV_TYPE_FIXED_WING, + mavutil.mavlink.MAV_TYPE_VTOL_QUADROTOR, + mavutil.mavlink.MAV_TYPE_VTOL_TILTROTOR, + ] + # VTOL_DUOROTOR was renamed to VTOL_TAILSITTER_DUOROTOR + for possible_plane_type in "VTOL_DUOROTOR", "VTOL_TAILSITTER_DUOROTOR": + t = f"MAV_TYPE_{possible_plane_type}" + attr = getattr(mavutil.mavlink, t, None) + if attr is None: + continue + mav_type_planes.append(attr) + def master_msg_handling(self, m, master): '''link message handling for an upstream link''' @@ -739,11 +752,7 @@ def master_msg_handling(self, m, master): self.status.last_mode_announced = master.flightmode self.say("Mode " + self.status.flightmode) - if m.type in [ - mavutil.mavlink.MAV_TYPE_FIXED_WING, - mavutil.mavlink.MAV_TYPE_VTOL_DUOROTOR, - mavutil.mavlink.MAV_TYPE_VTOL_QUADROTOR, - mavutil.mavlink.MAV_TYPE_VTOL_TILTROTOR]: + if m.type in self.mav_type_planes: self.mpstate.vehicle_type = 'plane' self.mpstate.vehicle_name = 'ArduPlane' elif m.type in [mavutil.mavlink.MAV_TYPE_GROUND_ROVER,