SlugsDataSensorView.h 11.1 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 31 32 33 34 35 36 37
/*=====================================================================

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/>.

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

/**
 * @file
 *   @brief Grpahical presentation of SLUGS generated data
 *
 *   @author Juan F. Robles  <jfroblesc@gmail.com>
 *
 */

#ifndef SLUGSDATASENSORVIEW_H
#define SLUGSDATASENSORVIEW_H

#include <QWidget>

#include "UASInterface.h"
tecnosapiens's avatar
tecnosapiens committed
38
#include "SlugsMAV.h"
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

namespace Ui {
    class SlugsDataSensorView;
}

class SlugsDataSensorView : public QWidget
{
    Q_OBJECT

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

public slots:
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets. If
         * there is no current UAS active, it sets it as active.

         * @param uas The UAS being added
    */
    void addUAS(UASInterface* uas);

    /**
         * @brief Sets the UAS as active
         *
         * @param uas The UAS being set as active
    */
    void setActiveUAS(UASInterface* uas);

    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */

    void refresh();


79 80


tecnosapiens's avatar
tecnosapiens committed
81 82 83 84 85
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
86
    void slugLocalPositionChanged(UASInterface* uas,
87 88 89 90
                                  double x,
                                  double y,
                                  double z,
                                  quint64 time);
tecnosapiens's avatar
tecnosapiens committed
91 92 93 94 95
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
96
    void slugSpeedLocalPositionChanged(UASInterface* uas,
97 98 99 100
                                       double vx,
                                       double vy,
                                       double vz,
                                       quint64 time);
tecnosapiens's avatar
tecnosapiens committed
101 102 103 104 105
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
106
    void slugAttitudeChanged(UASInterface* uas,
107 108 109 110
                             double slugroll,
                             double slugpitch,
                             double slugyaw,
                             quint64 time);
111 112 113 114 115 116 117 118 119 120 121

    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
    void slugsGlobalPositionChanged(UASInterface* uas,
                                    double lat,
                                    double lon,
                                    double alt,
                                    quint64 time);
tecnosapiens's avatar
tecnosapiens committed
122 123 124 125 126
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
127 128 129 130 131 132 133 134
    void slugsSensorBiasChanged(int systemId,
                                double axb,
                                double ayb,
                                double azb,
                                double gxb,
                                double gyb,
                                double gzb,
                                quint64 time);
tecnosapiens's avatar
tecnosapiens committed
135 136 137 138 139
    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
    void slugsDiagnosticMessageChanged(int systemId,
                                       double diagfl1,
                                       double diagfl2,
                                       double diagfl3,
                                       int16_t diagsh1,
                                       int16_t diagsh2,
                                       int16_t diagsh3,
                                       quint64 time);

    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
    void slugsCpuLoadChanged(int systemId,
                             uint8_t sensload,
                             uint8_t ctrlload,
                             uint8_t batvolt,
                             quint64 time);


    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
    void slugsNavegationChanged(int systemId,
                                double navu_m,
                                double navphi_c,
                                double navtheta_c,
                                double navpsiDot_c,
                                double navay_body,
                                double navtotalDist,
                                double navdist2Go,
                                uint8_t navfromWP,
                                uint8_t navtoWP,
                                quint64 time);

    /**
         * @brief Adds the UAS for data display
         *
         * Adds the UAS and makes all the correct connections for data display on the Widgets
    */
   void  slugsDataLogChanged(int systemId,
                            double logfl_1,
                            double logfl_2,
                            double logfl_3,
                            double logfl_4,
                            double logfl_5,
                            double logfl_6,
                            quint64 time);

   /**
        * @brief Adds the UAS for data display
        *
        * Adds the UAS and makes all the correct connections for data display on the Widgets
   */

   void slugsPWMChanged(int systemId,
                        uint16_t vdt_c,
                        uint16_t vdla_c,
                        uint16_t vdra_c,
                        uint16_t vdr_c,
                        uint16_t vdle_c,
                        uint16_t vdre_c,
                        uint16_t vdlf_c,
                        uint16_t vdrf_c,
                        uint16_t vda1_c,
                        uint16_t vda2_c,
                        quint64 time);

   /**
        * @brief Adds the UAS for data display
        *
        * Adds the UAS and makes all the correct connections for data display on the Widgets
   */
   void slugsFilteredDataChanged(int systemId,
                                 double filaX,
                                 double filaY,
                                 double filaZ,
                                 double filgX,
                                 double filgY,
                                 double filgZ,
                                 double filmX,
                                 double filmY,
                                 double filmZ,
                                 quint64 time);

228

229 230 231 232 233 234 235 236 237 238 239 240 241



    void slugsGPSDateTimeChanged(int systemId,
                                    uint8_t gpsyear,
                                     uint8_t gpsmonth,
                                     uint8_t gpsday,
                                     uint8_t gpshour,
                                     uint8_t gpsmin,
                                     uint8_t gpssec,
                                    uint8_t gpsvisSat,
                                    quint64 time);

242 243 244 245 246

protected:
    QTimer* updateTimer;
     UASInterface* activeUAS;

247 248 249 250 251 252
     //Global Position
     double Latitude;
     double Longitude;
     double Height;
     quint64 timeGlobalPosition;

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
     // Position and Attitude
     //Position
     double Xpos;
     double Ypos;
     double Zpos;
     quint64 TimeActualPosition;
     //Speed
     double VXpos;
     double VYpos;
     double VZpos;
     quint64 TimeActualSpeed;
     //Attitude
     double roll;
     double pitch;
     double yaw;
     quint64 TimeActualAttitude;

     //Sensor Biases
     //Acelerometer
     double Axb;
     double Ayb;
     double Azb;
275

276 277 278 279
     //Gyro
     double Gxb;
     double Gyb;
     double Gzb;
280 281
     quint64 TimeActualBias;

tecnosapiens's avatar
tecnosapiens committed
282 283 284 285 286 287 288 289
     //Diagnostic
     double diagFl1;
     double diagFl2;
     double diagFl3;
     int16_t diagSh1;
     int16_t diagSh2;
     int16_t diagSh3;
     quint64 timeDiagnostic;
290

291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351
     //CPU Load
     uint8_t sensLoad;
     uint8_t ctrlLoad;
     uint8_t batVolt;
     quint64 timeCpuLoad;

     //navigation data
     double u_m;
     double phi_c;
     double theta_c;
     double psiDot_c;
     double ay_body;
     double totalDist;
     double dist2Go;
     uint8_t fromWP;
     uint8_t toWP;
     quint64 timeNavigation;

     // Data Log
     double Logfl_1;
     double Logfl_2;
     double Logfl_3;
     double Logfl_4;
     double Logfl_5;
     double Logfl_6;
     quint64 timeDataLog;

     //pwm commands
     uint16_t dt_c; ///< AutoPilot's throttle command
     uint16_t dla_c; ///< AutoPilot's left aileron command
     uint16_t dra_c; ///< AutoPilot's right aileron command
     uint16_t dr_c; ///< AutoPilot's rudder command
     uint16_t dle_c; ///< AutoPilot's left elevator command
     uint16_t dre_c; ///< AutoPilot's right elevator command
     uint16_t dlf_c; ///< AutoPilot's left  flap command
     uint16_t drf_c; ///< AutoPilot's right flap command
     uint16_t aux1; ///< AutoPilot's aux1 command
     uint16_t aux2; ///< AutoPilot's aux2 command
     quint64 timePWMCommand;

     //filtered data
     double aX; ///< Accelerometer X value (m/s^2)
     double aY; ///< Accelerometer Y value (m/s^2)
     double aZ; ///< Accelerometer Z value (m/s^2)
     double gX; ///< Gyro X value (rad/s)
     double gY; ///< Gyro Y value (rad/s)
     double gZ; ///< Gyro Z value (rad/s)
     double mX; ///< Magnetometer X (normalized to 1)
     double mY; ///< Magnetometer Y (normalized to 1)
     double mZ; ///< Magnetometer Z (normalized to 1)
     quint64 timeFiltered;

     //gps date and time
     uint8_t year; ///< Year reported by Gps
     uint8_t month; ///< Month reported by Gps
     uint8_t day; ///< Day reported by Gps
     uint8_t hour; ///< Hour reported by Gps
     uint8_t min; ///< Min reported by Gps
     uint8_t sec; ///< Sec reported by Gps
     uint8_t visSat; ///< Visible sattelites reported by Gps
     quint64 timeGPSDateTime;
352 353 354 355 356 357 358 359 360 361


private:
    Ui::SlugsDataSensorView *ui;
    void loadParameters();


};

#endif // SLUGSDATASENSORVIEW_H