SlugsMAV.h 4.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*=====================================================================

QGroundControl Open Source Ground Control Station

(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

This file is part of the QGROUNDCONTROL project

    QGROUNDCONTROL is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QGROUNDCONTROL is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

======================================================================*/

#ifndef SLUGSMAV_H
#define SLUGSMAV_H

#include "UAS.h"
#include "mavlink.h"
#include <QTimer>

31
#define SLUGS_UPDATE_RATE   200   // in ms
32 33 34 35
class SlugsMAV : public UAS
{
    Q_OBJECT
    Q_INTERFACES(UASInterface)
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

    enum SLUGS_ACTION {
        SLUGS_ACTION_NONE,
        SLUGS_ACTION_SUCCESS,
        SLUGS_ACTION_FAIL,
        SLUGS_ACTION_EEPROM,
        SLUGS_ACTION_MODE_CHANGE,
        SLUGS_ACTION_MODE_REPORT,
        SLUGS_ACTION_PT_CHANGE,
        SLUGS_ACTION_PT_REPORT,
        SLUGS_ACTION_PID_CHANGE,
        SLUGS_ACTION_PID_REPORT,
        SLUGS_ACTION_WP_CHANGE,
        SLUGS_ACTION_WP_REPORT,
        SLUGS_ACTION_MLC_CHANGE,
        SLUGS_ACTION_MLC_REPORT
    };


55
public:
56
    SlugsMAV(MAVLinkProtocol* mavlink, QThread* thread, int id = 0);
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82

public slots:
    /** @brief Receive a MAVLink message from this MAV */
    void receiveMessage(LinkInterface* link, mavlink_message_t message);

    void emitSignals (void);

signals:

    void slugsRawImu(int uasId, const mavlink_raw_imu_t& rawData);
    void slugsGPSCogSog(int uasId, double cog, double sog);

#ifdef MAVLINK_ENABLED_SLUGS

    void slugsCPULoad(int systemId, const mavlink_cpu_load_t& cpuLoad);
    void slugsAirData(int systemId, const mavlink_air_data_t& airData);
    void slugsSensorBias(int systemId, const mavlink_sensor_bias_t& sensorBias);
    void slugsDiagnostic(int systemId, const mavlink_diagnostic_t& diagnostic);
    void slugsNavegation(int systemId, const mavlink_slugs_navigation_t& slugsNavigation);
    void slugsDataLog(int systemId, const mavlink_data_log_t& dataLog);
    void slugsGPSDateTime(int systemId, const mavlink_gps_date_time_t& gpsDateTime);
    void slugsActionAck(int systemId, const mavlink_action_ack_t& actionAck);

    void slugsBootMsg(int uasId, mavlink_boot_t& boot);
    void slugsAttitude(int uasId, mavlink_attitude_t& attitude);

83 84 85
    void slugsScaled(int uasId, const mavlink_scaled_imu_t& scaled);
    void slugsServo(int uasId, const mavlink_servo_output_raw_t& servo);
    void slugsChannels(int uasId, const mavlink_rc_channels_raw_t& channels);
86 87 88 89

#endif

protected:
90 91 92 93
    unsigned char updateRoundRobin;
    QTimer* widgetTimer;
    mavlink_raw_imu_t mlRawImuData;

94
#ifdef MAVLINK_ENABLED_SLUGS
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
    mavlink_gps_raw_t mlGpsData;
    mavlink_attitude_t mlAttitude;
    mavlink_cpu_load_t mlCpuLoadData;
    mavlink_air_data_t mlAirData;
    mavlink_sensor_bias_t mlSensorBiasData;
    mavlink_diagnostic_t mlDiagnosticData;
    mavlink_boot_t mlBoot;
    mavlink_gps_date_time_t mlGpsDateTime;
    mavlink_mid_lvl_cmds_t mlMidLevelCommands;
    mavlink_set_mode_t mlApMode;

    mavlink_slugs_navigation_t mlNavigation;
    mavlink_data_log_t mlDataLog;
    mavlink_ctrl_srfc_pt_t mlPassthrough;
    mavlink_action_ack_t mlActionAck;

    mavlink_slugs_action_t mlAction;

    mavlink_scaled_imu_t mlScaled;
    mavlink_servo_output_raw_t mlServo;
    mavlink_rc_channels_raw_t mlChannels;
116 117


118
    // Standart messages MAVLINK used by SLUGS
119 120 121
private:


122 123
    void emitGpsSignals (void);
    void emitPidSignal(void);
124

125
    int uasId;
126 127 128 129 130 131

#endif // if SLUGS

};

#endif // SLUGSMAV_H