]> git.mxchange.org Git - flightgear.git/blobdiff - utils/GPSsmooth/UGear.hxx
Allow setting of NED velocities.
[flightgear.git] / utils / GPSsmooth / UGear.hxx
index 5bdba2ef5df86d5be9274ab8030b3c02adcdb949..ef35d0d18026ac446ad6b9100f11111cd972daa6 100644 (file)
 #include <simgear/io/iochannel.hxx>
 #include <simgear/serial/serial.hxx>
 
-SG_USING_STD(cout);
-SG_USING_STD(endl);
-SG_USING_STD(string);
-SG_USING_STD(vector);
+using std::cout;
+using std::endl;
+using std::string;
+using std::vector;
 
 
 enum ugPacketType {
@@ -31,50 +31,54 @@ enum ugPacketType {
 };
 
 struct imu {
+   double time;
    double p,q,r;               /* angular velocities    */
    double ax,ay,az;            /* acceleration          */
    double hx,hy,hz;             /* magnetic field       */
    double Ps,Pt;                /* static/pitot pressure */
    // double Tx,Ty,Tz;          /* temperature           */
    double phi,the,psi;          /* attitudes             */
-   short  err_type;            /* error type            */
-   double time;
+   uint64_t err_type;          /* error type            */
 };
 
 struct gps {
+   double time;
    double lat,lon,alt;          /* gps position          */
    double ve,vn,vd;             /* gps velocity          */
-   uint16_t ITOW;
-   short  err_type;             /* error type            */
-   double time;
+   double ITOW;
+   uint64_t err_type;           /* error type            */
 };
 
 struct nav {
+   double time;
    double lat,lon,alt;
    double ve,vn,vd;
    // float  t;
-   short  err_type;
-   double time;
+   uint64_t err_type;
 };
 
 struct servo {
-   uint16_t chn[8];
-   uint8_t status;
    double time;
+   uint16_t chn[8];
+   uint64_t status;
 };
 
 struct health {
-    float volts_raw;            /* raw volt reading */
-    float volts;                /* filtered volts */
-    uint16_t est_seconds;       /* estimated useful seconds remaining */
-    uint8_t loadavg;            /* system "1 minute" load average */
-    uint8_t ahrs_hz;            /* actual ahrs loop hz */
-    uint8_t nav_hz;             /* actual nav loop hz */
     double time;
+    double target_roll_deg;     /* AP target roll angle */
+    double target_heading_deg;  /* AP target heading angle */
+    double target_pitch_deg;    /* AP target pitch angle */
+    double target_climb_fps;    /* AP target climb rate */
+    double target_altitude_ft;  /* AP target altitude */
+    uint64_t command_sequence;  /* highest received command sequence num */
+    uint64_t target_waypoint;   /* index of current waypoint target */
+    uint64_t loadavg;           /* system "1 minute" load average */
+    uint64_t ahrs_hz;           /* actual ahrs loop hz */
+    uint64_t nav_hz;            /* actual nav loop hz */
 };
 
 // Manage a saved ugear log (track file)
-class UGEARTrack {
+class UGTrack {
 
 private:
 
@@ -90,10 +94,14 @@ private:
                    gps *gpspacket, imu *imupacket, nav *navpacket,
                    servo *servopacket, health *healthpacket );
 
+    // activate special double swap logic for non-standard stargate
+    // double format
+    bool sg_swap;
+
 public:
 
-    UGEARTrack();
-    ~UGEARTrack();
+    UGTrack();
+    ~UGTrack();
 
     // read/parse the next message from the specified data stream,
     // returns id # if a valid message found.
@@ -106,8 +114,11 @@ public:
                      servo *servopacket, health *healthpacket,
                      bool ignore_checksum );
 
-    // load the named file into internal buffers
-    bool load( const string &file, bool ignore_checksum );
+    // load the named stream log file into internal buffers
+    bool load_stream( const string &file, bool ignore_checksum );
+
+    // load the named flight files into internal buffers
+    bool load_flight( const string &path );
 
     inline int gps_size() const { return gps_data.size(); }
     inline int imu_size() const { return imu_data.size(); }
@@ -157,6 +168,11 @@ public:
     }
        
 
+    // set stargate mode where we have to do an odd swapping of doubles to
+    // account for their non-standard formate
+    inline void set_stargate_swap_mode() {
+        sg_swap = true;
+    }
 };