Difference between revisions of "Software Documentation"

From AD7ZJ Wiki
Jump to navigation Jump to search
(Created page with "Most of the software is documented using specially formatted comments that can be parsed by doxygen. This mostly details what each function does and what kind of parameters t...")
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Most of the software is documented using specially formatted comments that can be parsed by doxygen.  This mostly details what each function does and what kind of parameters to give it.  Anything else that isn't detailed there will be put below
 
Most of the software is documented using specially formatted comments that can be parsed by doxygen.  This mostly details what each function does and what kind of parameters to give it.  Anything else that isn't detailed there will be put below
  
==GPS File Layout==
+
==Landing Predictions==
{| class="wikitable"
+
The landing prediction method works by figuring out the wind speed and direction at various altitudes on ascent and then extrapolating that during the descent. 
|-
+
 
! Size (bits)
+
Every NAV_INTERVAL ft of altitude, another entry is made in the windData[] array.  This is an array of NAV_WINDDATA which has the following form:
! Description
+
 
|-
+
    typedef struct {
| 8
+
        /// time of day in seconds
| Hours, GMT
+
        uint32_t timeStamp;
|-
+
        /// time difference in seconds from the previous entry
| 8
+
        uint16_t timeInterval;
| Minutes
+
        COURSE course;
|-
+
        COORD coord;
| 8
+
    } NAV_WINDDATA;
| Seconds
+
 
|-
+
A COURSE structure looks like this:
| 32
+
 
| Latitude in degrees * 10^7 where + is North and - is South
+
    typedef struct {
|-
+
        /// distance in radians
| 32
+
        float dist;
| Longitude in degrees * 10^7 where + is East and - is West
+
        /// heading in radians referenced to true north
|-
+
        float head;
| 32
+
        /// currently not used
| Altitude above MSL in cm
+
        float trackError;
|-
+
    } COURSE;
| 16
+
 
| Groundspeed in cm/s
+
And a COORD structure looks like this:
|-
+
 
| 16
+
    typedef struct {
| Heading CW from north in units of 0.01 degrees
+
        /// lat and long in radians
|-
+
        float lat, lon;
| 16
+
        /// altitude in ft
| Number of tracked Satellites
+
        int32_t alt;
|}
+
    } COORD;
 +
 
 +
So during the ascent, every 500ft the computer figures out the vector between the current lat/long and the previous entry in the table and saves the magnitude of that as 'dist' and the direction as 'head' in the COURSE structure.  The current altitude is also stored in 'alt' in the COORD structure. 
 +
 
 +
Then after descent is detected, the computer first iterates through the windData[] array and places the current index such that only the entries for altitudes less than the current altitude will be handled.  It then iterates through the remaining entries, each time using dist = rate * time to create a vector starting at the current location whose direction is the same as was determined on ascent but whose magnitude is determined by scaling the ascent rate vector's magnitude by a fraction of how much of that original time will now be spent in the segment (descent goes much faster than ascent so this number will be < 1).
 +
 
 +
The only real trick here is figuring out the 'time' part of the equation as the descent rate is not linear and really depends on the size of the parachute and weight of the payload train.  Currently this is done using a 4th order polynomial best-fit to a descent curve of a previous flight.  But this is where most the inaccuracy in the prediction comes from as this curve will change depending on the previously mentioned parameters. 
 +
 
 +
Once the vector for a particular segment is determined, the coordinate for it's head is determined and then set as the starting coordinate for the next entry in the table.  This is continued for the remainder of the wind table and the head of the final vector is the landing estimate.

Latest revision as of 22:48, 31 December 2014

Most of the software is documented using specially formatted comments that can be parsed by doxygen. This mostly details what each function does and what kind of parameters to give it. Anything else that isn't detailed there will be put below

Landing Predictions

The landing prediction method works by figuring out the wind speed and direction at various altitudes on ascent and then extrapolating that during the descent.

Every NAV_INTERVAL ft of altitude, another entry is made in the windData[] array. This is an array of NAV_WINDDATA which has the following form:

   typedef struct {
       /// time of day in seconds
       uint32_t timeStamp;
       /// time difference in seconds from the previous entry
       uint16_t timeInterval;
       COURSE course;
       COORD coord;
   } NAV_WINDDATA;

A COURSE structure looks like this:

   typedef struct {
       /// distance in radians
       float dist;
       /// heading in radians referenced to true north
       float head;
       /// currently not used
       float trackError;
   } COURSE;

And a COORD structure looks like this:

   typedef struct {
       /// lat and long in radians
       float lat, lon;
       /// altitude in ft
       int32_t alt;
   } COORD;

So during the ascent, every 500ft the computer figures out the vector between the current lat/long and the previous entry in the table and saves the magnitude of that as 'dist' and the direction as 'head' in the COURSE structure. The current altitude is also stored in 'alt' in the COORD structure.

Then after descent is detected, the computer first iterates through the windData[] array and places the current index such that only the entries for altitudes less than the current altitude will be handled. It then iterates through the remaining entries, each time using dist = rate * time to create a vector starting at the current location whose direction is the same as was determined on ascent but whose magnitude is determined by scaling the ascent rate vector's magnitude by a fraction of how much of that original time will now be spent in the segment (descent goes much faster than ascent so this number will be < 1).

The only real trick here is figuring out the 'time' part of the equation as the descent rate is not linear and really depends on the size of the parachute and weight of the payload train. Currently this is done using a 4th order polynomial best-fit to a descent curve of a previous flight. But this is where most the inaccuracy in the prediction comes from as this curve will change depending on the previously mentioned parameters.

Once the vector for a particular segment is determined, the coordinate for it's head is determined and then set as the starting coordinate for the next entry in the table. This is continued for the remainder of the wind table and the head of the final vector is the landing estimate.