ArduCopterFirmwarePlugin.h 3.31 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10 11 12 13 14 15 16 17 18

/// @file
///     @author Don Gagne <don@thegagnes.com>

#ifndef ArduCopterFirmwarePlugin_H
#define ArduCopterFirmwarePlugin_H

#include "APMFirmwarePlugin.h"

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
class APMCopterMode : public APMCustomMode
{
public:
    enum Mode {
        STABILIZE   = 0,   // hold level position
        ACRO        = 1,   // rate control
        ALT_HOLD    = 2,   // AUTO control
        AUTO        = 3,   // AUTO control
        GUIDED      = 4,   // AUTO control
        LOITER      = 5,   // Hold a single location
        RTL         = 6,   // AUTO control
        CIRCLE      = 7,   // AUTO control
        POSITION    = 8,   // AUTO control
        LAND        = 9,   // AUTO control
        OF_LOITER   = 10,  // Hold a single location using optical flow
                           // sensor
        DRIFT       = 11,  // Drift 'Car Like' mode
        RESERVED_12 = 12,  // RESERVED FOR FUTURE USE
        SPORT       = 13,  // [TODO] Verify this is correct.
        FLIP        = 14,
        AUTOTUNE    = 15,
        POS_HOLD    = 16, // HYBRID LOITER.
        BRAKE       = 17
    };
    static const int modeCount = 18;

    APMCopterMode(uint32_t mode, bool settable);
};

48 49 50
class ArduCopterFirmwarePlugin : public APMFirmwarePlugin
{
    Q_OBJECT
51

52
public:
53
    ArduCopterFirmwarePlugin(void);
Don Gagne's avatar
Don Gagne committed
54 55

    // Overrides from FirmwarePlugin
56
    bool isCapable(const Vehicle *vehicle, FirmwareCapabilities capabilities) final;
Don Gagne's avatar
Don Gagne committed
57 58 59 60
    void setGuidedMode(Vehicle* vehicle, bool guidedMode) final;
    void pauseVehicle(Vehicle* vehicle) final;
    void guidedModeRTL(Vehicle* vehicle) final;
    void guidedModeLand(Vehicle* vehicle) final;
61 62 63 64
#if 0
    // WIP
    void guidedModeTakeoff(Vehicle* vehicle) final;
#endif
Don Gagne's avatar
Don Gagne committed
65
    void guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoordinate& gotoCoord) final;
66
    void guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange) final;
67
    const FirmwarePlugin::remapParamNameMajorVersionMap_t& paramNameRemapMajorVersionMap(void) const final { return _remapParamName; }
68 69 70 71
    int remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const final;
    bool multiRotorCoaxialMotors(Vehicle* vehicle) final;
    bool multiRotorXConfig(Vehicle* vehicle) final;
    QString geoFenceRadiusParam(Vehicle* vehicle) final;
72
    QString offlineEditingParamFile(Vehicle* vehicle) final { Q_UNUSED(vehicle); return QStringLiteral(":/FirmwarePlugin/APM/Copter.OfflineEditing.params"); }
73 74 75 76 77
    QString pauseFlightMode(void) const override { return QString("Brake"); }
    QString missionFlightMode(void) const override { return QString("Auto"); }
    QString rtlFlightMode(void) const override { return QString("RTL"); }
    QString landFlightMode(void) const override { return QString("Land"); }
    QString takeControlFlightMode(void) const override { return QString("Stablize"); }
78
    bool vehicleYawsToNextWaypointInMission(const Vehicle* vehicle) const final;
79 80 81 82

private:
    static bool _remapParamNameIntialized;
    static FirmwarePlugin::remapParamNameMajorVersionMap_t  _remapParamName;
83 84 85
};

#endif