ArduRoverFirmwarePlugin.cc 2.93 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
#include "ArduRoverFirmwarePlugin.h"
11
#include "QGCApplication.h"
12

13 14 15
bool ArduRoverFirmwarePlugin::_remapParamNameIntialized = false;
FirmwarePlugin::remapParamNameMajorVersionMap_t ArduRoverFirmwarePlugin::_remapParamName;

Don Gagne's avatar
Don Gagne committed
16 17
APMRoverMode::APMRoverMode(uint32_t mode, bool settable)
    : APMCustomMode(mode, settable)
18
{
19 20 21 22 23 24 25 26 27 28 29 30 31 32
    setEnumToStringMapping({
        {MANUAL,         "Manual"},
        {ACRO,           "Acro"},
        {STEERING,       "Steering"},
        {HOLD,           "Hold"},
        {LOITER,         "Loiter"},
        {FOLLOW,         "Follow"},
        {SIMPLE,         "Simple"},
        {AUTO,           "Auto"},
        {RTL,            "RTL"},
        {SMART_RTL,      "Smart RTL"},
        {GUIDED,         "Guided"},
        {INITIALIZING,   "Initializing"},
    });
33 34
}

35
ArduRoverFirmwarePlugin::ArduRoverFirmwarePlugin(void)
36
{
37 38 39 40 41 42 43 44 45 46 47 48 49 50
    setSupportedModes({
        APMRoverMode(APMRoverMode::MANUAL       ,true),
        APMRoverMode(APMRoverMode::ACRO         ,true),
        APMRoverMode(APMRoverMode::STEERING     ,true),
        APMRoverMode(APMRoverMode::HOLD         ,true),
        APMRoverMode(APMRoverMode::LOITER       ,true),
        APMRoverMode(APMRoverMode::FOLLOW       ,true),
        APMRoverMode(APMRoverMode::SIMPLE       ,true),
        APMRoverMode(APMRoverMode::AUTO         ,true),
        APMRoverMode(APMRoverMode::RTL          ,true),
        APMRoverMode(APMRoverMode::SMART_RTL    ,true),
        APMRoverMode(APMRoverMode::GUIDED       ,true),
        APMRoverMode(APMRoverMode::INITIALIZING ,false),
    });
51 52

    if (!_remapParamNameIntialized) {
53 54 55 56 57
        FirmwarePlugin::remapParamNameMap_t& remapV3_5 = _remapParamName[3][5];

        remapV3_5["BATT_ARM_VOLT"] =    QStringLiteral("ARMING_VOLT_MIN");
        remapV3_5["BATT2_ARM_VOLT"] =   QStringLiteral("ARMING_VOLT2_MIN");

58 59
        _remapParamNameIntialized = true;
    }
60
}
61 62 63

int ArduRoverFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersionNumber) const
{
64 65
    // Remapping supports up to 3.5
    return majorVersionNumber == 3 ? 5 : Vehicle::versionNotSetValue;
66 67
}

68 69 70 71 72 73 74
void ArduRoverFirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange)
{
    Q_UNUSED(vehicle);
    Q_UNUSED(altitudeChange);

    qgcApp()->showMessage(QStringLiteral("Change altitude not supported."));
}
75

76
bool ArduRoverFirmwarePlugin::supportsNegativeThrust(Vehicle* /*vehicle*/)
77 78 79
{
    return true;
}
80 81 82 83 84

void ArduRoverFirmwarePlugin::sendGCSMotionReport(Vehicle* vehicle, FollowMe::GCSMotionReport& motionReport, uint8_t estimatationCapabilities)
{
    _sendGCSMotionReport(vehicle, motionReport, estimatationCapabilities);
}