From 4335dbadd9d3bee3c4bebf309492e2dd1f531fc9 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Thu, 18 Aug 2016 13:18:53 -0700 Subject: [PATCH] Add vehicle type routines --- src/comm/QGCMAVLink.cc | 56 ++++++++++++++++++++++++++++++++++++++++++ src/comm/QGCMAVLink.h | 9 +++++++ 2 files changed, 65 insertions(+) create mode 100644 src/comm/QGCMAVLink.cc diff --git a/src/comm/QGCMAVLink.cc b/src/comm/QGCMAVLink.cc new file mode 100644 index 000000000..fab487207 --- /dev/null +++ b/src/comm/QGCMAVLink.cc @@ -0,0 +1,56 @@ +/**************************************************************************** + * + * (c) 2009-2016 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + ****************************************************************************/ + +#include "QGCMAVLink.h" + +bool QGCMAVLink::isFixedWing(MAV_TYPE mavType) +{ + return mavType == MAV_TYPE_FIXED_WING; +} + +bool QGCMAVLink::isRover(MAV_TYPE mavType) +{ + return mavType == MAV_TYPE_GROUND_ROVER; +} + +bool QGCMAVLink::isSub(MAV_TYPE mavType) +{ + return mavType == MAV_TYPE_SUBMARINE; +} + +bool QGCMAVLink::isMultiRotor(MAV_TYPE mavType) +{ + switch (mavType) { + case MAV_TYPE_QUADROTOR: + case MAV_TYPE_COAXIAL: + case MAV_TYPE_HELICOPTER: + case MAV_TYPE_HEXAROTOR: + case MAV_TYPE_OCTOROTOR: + case MAV_TYPE_TRICOPTER: + return true; + default: + return false; + } +} + +bool QGCMAVLink::isVTOL(MAV_TYPE mavType) +{ + switch (mavType) { + case MAV_TYPE_VTOL_DUOROTOR: + case MAV_TYPE_VTOL_QUADROTOR: + case MAV_TYPE_VTOL_TILTROTOR: + case MAV_TYPE_VTOL_RESERVED2: + case MAV_TYPE_VTOL_RESERVED3: + case MAV_TYPE_VTOL_RESERVED4: + case MAV_TYPE_VTOL_RESERVED5: + return true; + default: + return false; + } +} diff --git a/src/comm/QGCMAVLink.h b/src/comm/QGCMAVLink.h index 270c8395f..744bd5a51 100644 --- a/src/comm/QGCMAVLink.h +++ b/src/comm/QGCMAVLink.h @@ -19,5 +19,14 @@ #include +class QGCMAVLink { +public: + static bool isFixedWing(MAV_TYPE mavType); + static bool isRover(MAV_TYPE mavType); + static bool isSub(MAV_TYPE mavType); + static bool isMultiRotor(MAV_TYPE mavType); + static bool isVTOL(MAV_TYPE mavType); +}; + #endif // QGCMAVLINK_H -- 2.22.0