QGCPX4VehicleConfig.h 3.14 KB
Newer Older
1 2 3 4 5 6 7 8
#ifndef QGCPX4VehicleConfig_H
#define QGCPX4VehicleConfig_H

#include <QWidget>
#include <QTimer>
#include <QList>
#include <QGroupBox>
#include <QPushButton>
9
#include <QStringList>
10
#include <QMessageBox>
Lorenz Meier's avatar
Lorenz Meier committed
11
#include <QGraphicsScene>
12 13 14

#include "QGCToolWidget.h"
#include "UASInterface.h"
15
#include "px4_configuration/QGCPX4AirframeConfig.h"
16

17
class UASParameterCommsMgr;
18
class QGCPX4SensorCalibration;
19
class PX4RCCalibration;
20

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
namespace Ui {
class QGCPX4VehicleConfig;
}

class QGCPX4VehicleConfig : public QWidget
{
    Q_OBJECT

public:
    explicit QGCPX4VehicleConfig(QWidget *parent = 0);
    ~QGCPX4VehicleConfig();

    enum RC_MODE {
        RC_MODE_1 = 1,
        RC_MODE_2 = 2,
        RC_MODE_3 = 3,
        RC_MODE_4 = 4,
        RC_MODE_NONE = 5
    };

public slots:
    void rcMenuButtonClicked();
    void sensorMenuButtonClicked();
44
    void tuningMenuButtonClicked();
Lorenz Meier's avatar
Lorenz Meier committed
45 46
    void flightModeMenuButtonClicked();
    void safetyConfigMenuButtonClicked();
47
    void advancedMenuButtonClicked();
48
    void airframeMenuButtonClicked();
49 50
    void firmwareMenuButtonClicked();

51 52 53 54 55 56
    /** Set the MAV currently being calibrated */
    void setActiveUAS(UASInterface* active);
    /** Fallback function, automatically called by loadConfig() upon failure to find and xml file*/
    void loadQgcConfig(bool primary);
    /** Load configuration from xml file */
    void loadConfig();
57

58 59 60 61 62 63 64 65
protected slots:
    void menuButtonClicked();
    /** Parameter changed onboard */
    void parameterChanged(int uas, int component, QString parameterName, QVariant value);
    void updateStatus(const QString& str);
    void updateError(const QString& str);

protected:
66

67 68
    bool doneLoadingConfig;
    UASInterface* mav;                  ///< The current MAV
69
    QGCUASParamManagerInterface* paramMgr;       ///< params mgr for the mav
70
    QList<QGCToolWidget*> toolWidgets;  ///< Configurable widgets
71
    QMap<QString,QGCToolWidget*> toolWidgetsByName; ///<
72 73 74 75 76 77 78 79

    QMap<QString,QGCToolWidget*> paramToWidgetMap;                     ///< Holds the current active MAV's parameter widgets.
    QList<QWidget*> additionalTabs;                                   ///< Stores additional tabs loaded for this vehicle/autopilot configuration. Used for cleaning up.
    QMap<QString,QGCToolWidget*> libParamToWidgetMap;                  ///< Holds the library parameter widgets
    QMap<QString,QMap<QString,QGCToolWidget*> > systemTypeToParamMap;   ///< Holds all loaded MAV specific parameter widgets, for every MAV.
    QMap<QGCToolWidget*,QGroupBox*> toolToBoxMap;                       ///< Easy method of figuring out which QGroupBox is tied to which ToolWidget.
    QMap<QString,QString> paramTooltips;                                ///< Tooltips for the ? button next to a parameter.

80
    QGCPX4AirframeConfig* px4AirframeConfig;
Lorenz Meier's avatar
Lorenz Meier committed
81 82
    QPixmap planeBack;
    QPixmap planeSide;
83
    QGCPX4SensorCalibration* px4SensorCalibration;
84
    PX4RCCalibration* px4RCCalibration;
85
    QMessageBox msgBox;
Lorenz Meier's avatar
Lorenz Meier committed
86
    QGraphicsScene scene;
87
    QPushButton* skipActionButton;
88

89 90 91 92 93 94 95 96
private:
    Ui::QGCPX4VehicleConfig *ui;
    QMap<QPushButton*,QWidget*> buttonToWidgetMap;
signals:
    void visibilityChanged(bool visible);
};

#endif // QGCPX4VehicleConfig_H