QGCVehicleConfig.h 3.27 KB
Newer Older
1 2 3 4
#ifndef QGCVEHICLECONFIG_H
#define QGCVEHICLECONFIG_H

#include <QWidget>
5
#include <QTimer>
6

7 8
#include "UASInterface.h"

9 10 11 12 13 14 15 16 17 18 19
namespace Ui {
class QGCVehicleConfig;
}

class QGCVehicleConfig : public QWidget
{
    Q_OBJECT
    
public:
    explicit QGCVehicleConfig(QWidget *parent = 0);
    ~QGCVehicleConfig();
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63

public slots:
    /** Set the MAV currently being calibrated */
    void setActiveUAS(UASInterface* active);

    /** Start the RC calibration routine */
    void startCalibrationRC();
    /** Stop the RC calibration routine */
    void stopCalibrationRC();
    /** Start/stop the RC calibration routine */
    void toggleCalibrationRC(bool enabled);
    /** Render the data updated */
    void updateView();

protected slots:
    /** Reset the RC calibration */
    void resetCalibrationRC();
    /** Write the RC calibration */
    void writeCalibrationRC();
    /** Request the RC calibration */
    void requestCalibrationRC();
    /** Store all parameters in onboard EEPROM */
    void writeParameters();
    /** Receive remote control updates from MAV */
    void remoteControlChannelRawChanged(int chan, float val);
    /** Parameter changed onboard */
    void parameterChanged(int uas, int component, QString parameterName, QVariant value);
    void updateStatus(const QString& str);
    void updateError(const QString& str);
    void setRCType(int type);
    /** Check timeouts */
    void checktimeOuts();

protected:
    UASInterface* mav;                  ///< The current MAV
    static const unsigned int chanMax = 8;    ///< Maximum number of channels
    int rcType;                         ///< Type of the remote control
    quint64 rcTypeUpdateRequested;      ///< Zero if not requested, non-zero if requested
    static const unsigned int rcTypeTimeout = 5000; ///< 5 seconds timeout, in milliseconds
    int rcMin[chanMax];                 ///< Minimum values
    int rcMax[chanMax];                 ///< Maximum values
    int rcTrim[chanMax];                ///< Zero-position (center for roll/pitch/yaw, 0 throttle for throttle)
    int rcMapping[chanMax];             ///< PWM to function mappings
    bool rcRev[chanMax];                ///< Channel reverse
64
    int rcValue[chanMax];               ///< Last values
65 66 67 68 69 70 71 72 73 74
    float rcRoll;                       ///< PPM input channel used as roll control input
    float rcPitch;                      ///< PPM input channel used as pitch control input
    float rcYaw;                        ///< PPM input channel used as yaw control input
    float rcThrottle;                   ///< PPM input channel used as throttle control input
    float rcMode;                       ///< PPM input channel used as mode switch control input
    float rcAux1;                       ///< PPM input channel used as aux 1 input
    float rcAux2;                       ///< PPM input channel used as aux 1 input
    float rcAux3;                       ///< PPM input channel used as aux 1 input
    bool rcCalChanged;                  ///< Set if the calibration changes (and needs to be written)
    bool changed;                       ///< Set if any of the input data changed
75
    QTimer updateTimer;                 ///< Controls update intervals
76 77 78
    
private:
    Ui::QGCVehicleConfig *ui;
79 80 81

signals:
    void visibilityChanged(bool visible);
82 83 84
};

#endif // QGCVEHICLECONFIG_H