2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
SystemState.h@24:a7f92dfc5310, 2018-12-21 (annotated)
- Committer:
- shimniok
- Date:
- Fri Dec 21 20:04:09 2018 +0000
- Revision:
- 24:a7f92dfc5310
- Parent:
- 9:fc3575d2cbbf
- Child:
- 29:cb2f55fbfe9c
thread changes, added stats command, added sd filesystem, other minor changes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 9:fc3575d2cbbf | 1 | #ifndef _SYSTEMSTATE_H |
shimniok | 9:fc3575d2cbbf | 2 | #define _SYSTEMSTATE_H |
shimniok | 9:fc3575d2cbbf | 3 | |
shimniok | 9:fc3575d2cbbf | 4 | /** System State is the main mechanism for communicating current realtime system state to |
shimniok | 9:fc3575d2cbbf | 5 | * the rest of the system for logging, data display, etc. |
shimniok | 9:fc3575d2cbbf | 6 | */ |
shimniok | 9:fc3575d2cbbf | 7 | |
shimniok | 9:fc3575d2cbbf | 8 | #include <stdbool.h> |
shimniok | 9:fc3575d2cbbf | 9 | |
shimniok | 9:fc3575d2cbbf | 10 | /* struct systemState |
shimniok | 9:fc3575d2cbbf | 11 | * structure containing system sensor data |
shimniok | 9:fc3575d2cbbf | 12 | ****** System Status |
shimniok | 9:fc3575d2cbbf | 13 | * millis number of milliseconds since epoch (or startup) |
shimniok | 9:fc3575d2cbbf | 14 | * current current draw in amps |
shimniok | 9:fc3575d2cbbf | 15 | * voltage voltage in volts |
shimniok | 9:fc3575d2cbbf | 16 | ****** Data reported by IMU |
shimniok | 9:fc3575d2cbbf | 17 | * g[3] raw 3-axis gyro values; if using 1-axis, then store data in gx |
shimniok | 9:fc3575d2cbbf | 18 | * gTemp Gyro temperature |
shimniok | 9:fc3575d2cbbf | 19 | * a[3] raw 3-axis accelerometer values |
shimniok | 9:fc3575d2cbbf | 20 | * m[3] raw 3-axis magnetometer values; if using 2d then store data in mx and my |
shimniok | 9:fc3575d2cbbf | 21 | * gHeading independently calculated gyro heading in degrees |
shimniok | 9:fc3575d2cbbf | 22 | * cHeading independently calculated compass heading in degrees |
shimniok | 9:fc3575d2cbbf | 23 | ****** AHRS Estimates |
shimniok | 9:fc3575d2cbbf | 24 | * roll, pitch, yaw estimated attitude in degrees relative to the world frame |
shimniok | 9:fc3575d2cbbf | 25 | ****** Data reported by GPS |
shimniok | 9:fc3575d2cbbf | 26 | * gpsLatitude raw GPS latitude in fractional degrees (e.g., 39.123456) |
shimniok | 9:fc3575d2cbbf | 27 | * gpsLongitude raw GPS longitude in fractional degrees (e.g., -104.123456 |
shimniok | 9:fc3575d2cbbf | 28 | * gpsCourse_deg raw GPS course in degrees |
shimniok | 9:fc3575d2cbbf | 29 | * gpsSpeed_mps raw GPS speed in m/s |
shimniok | 9:fc3575d2cbbf | 30 | * gpsHDOP raw GPS Horizontal Dilution of Precision |
shimniok | 9:fc3575d2cbbf | 31 | * gpsSats raw GPS Satellite fix count |
shimniok | 9:fc3575d2cbbf | 32 | ****** Odometry data |
shimniok | 9:fc3575d2cbbf | 33 | * lrEncDistance left rear encoder distance since last log update |
shimniok | 9:fc3575d2cbbf | 34 | * rrEncDistance right rear encoder distance since last log update |
shimniok | 9:fc3575d2cbbf | 35 | * lrEncSpeed left rear encoder speed |
shimniok | 9:fc3575d2cbbf | 36 | * rrEncSpeed right rear encoder speed |
shimniok | 9:fc3575d2cbbf | 37 | * encHeading estimated heading based on encoder readings |
shimniok | 9:fc3575d2cbbf | 38 | ****** Estimated Position and Heading |
shimniok | 9:fc3575d2cbbf | 39 | * estLagHeading estimated heading in degrees, lagged to sync with gps |
shimniok | 9:fc3575d2cbbf | 40 | * estHeading estimated current heading |
shimniok | 9:fc3575d2cbbf | 41 | * estLatitude estimated latitude in fractional degrees (e.g., 39.123456) |
shimniok | 9:fc3575d2cbbf | 42 | * estLongitude estimated longitude in fractional degrees (e.g., -104.123456) |
shimniok | 9:fc3575d2cbbf | 43 | * estNorthing some algorithms use UTM. Estimated UTM northing |
shimniok | 9:fc3575d2cbbf | 44 | * estEasting estimated UTM easting |
shimniok | 9:fc3575d2cbbf | 45 | * estX, estY some algorithms use simple x, y distance from origin (meters) |
shimniok | 9:fc3575d2cbbf | 46 | ****** Waypoint data |
shimniok | 9:fc3575d2cbbf | 47 | * nextWaypoint integer ID of the next waypoint |
shimniok | 9:fc3575d2cbbf | 48 | * bearing estimated bearing to next waypoint in degrees |
shimniok | 9:fc3575d2cbbf | 49 | * distance estimated distance to next waypoint in meters |
shimniok | 9:fc3575d2cbbf | 50 | ****** Control data |
shimniok | 9:fc3575d2cbbf | 51 | * throttle raw servo setting(units?) |
shimniok | 9:fc3575d2cbbf | 52 | * steering raw servo setting(units?) |
shimniok | 9:fc3575d2cbbf | 53 | */ |
shimniok | 24:a7f92dfc5310 | 54 | |
shimniok | 9:fc3575d2cbbf | 55 | typedef struct { |
shimniok | 24:a7f92dfc5310 | 56 | double latitude; |
shimniok | 24:a7f92dfc5310 | 57 | double longitude; |
shimniok | 24:a7f92dfc5310 | 58 | float course; |
shimniok | 24:a7f92dfc5310 | 59 | float speed; |
shimniok | 24:a7f92dfc5310 | 60 | float hdop; |
shimniok | 24:a7f92dfc5310 | 61 | int svcount; |
shimniok | 24:a7f92dfc5310 | 62 | } GpsData; |
shimniok | 9:fc3575d2cbbf | 63 | |
shimniok | 24:a7f92dfc5310 | 64 | #if 0 == 1 |
shimniok | 9:fc3575d2cbbf | 65 | void state_clear( SystemState *s ); |
shimniok | 9:fc3575d2cbbf | 66 | bool fifo_init(void); |
shimniok | 9:fc3575d2cbbf | 67 | void fifo_reset(void); |
shimniok | 9:fc3575d2cbbf | 68 | bool fifo_available(void); |
shimniok | 9:fc3575d2cbbf | 69 | bool fifo_push(SystemState *s); |
shimniok | 9:fc3575d2cbbf | 70 | SystemState *fifo_first(void); |
shimniok | 9:fc3575d2cbbf | 71 | SystemState *fifo_last(void); |
shimniok | 9:fc3575d2cbbf | 72 | SystemState *fifo_pull(void); |
shimniok | 9:fc3575d2cbbf | 73 | int fifo_getInState(void); |
shimniok | 9:fc3575d2cbbf | 74 | int fifo_getOutState(void); |
shimniok | 24:a7f92dfc5310 | 75 | #endif |
shimniok | 9:fc3575d2cbbf | 76 | |
shimniok | 9:fc3575d2cbbf | 77 | #endif |