2018 revision to classic DataBus AVC code.
Dependencies: LSM303DLM Servo SerialGraphicLCD L3G4200D IncrementalEncoder SimpleShell
SystemState.h@32:eb673f6f5734, 2018-12-27 (annotated)
- Committer:
- shimniok
- Date:
- Thu Dec 27 15:46:57 2018 +0000
- Revision:
- 32:eb673f6f5734
- Parent:
- 30:ed791f1f7f7d
Added accel & mag to data collection and logging
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 | 30:ed791f1f7f7d | 56 | uint64_t timestamp; |
shimniok | 24:a7f92dfc5310 | 57 | double latitude; |
shimniok | 24:a7f92dfc5310 | 58 | double longitude; |
shimniok | 24:a7f92dfc5310 | 59 | float course; |
shimniok | 24:a7f92dfc5310 | 60 | float speed; |
shimniok | 24:a7f92dfc5310 | 61 | float hdop; |
shimniok | 24:a7f92dfc5310 | 62 | int svcount; |
shimniok | 24:a7f92dfc5310 | 63 | } GpsData; |
shimniok | 9:fc3575d2cbbf | 64 | |
shimniok | 30:ed791f1f7f7d | 65 | |
shimniok | 30:ed791f1f7f7d | 66 | typedef struct { |
shimniok | 30:ed791f1f7f7d | 67 | uint64_t timestamp; |
shimniok | 30:ed791f1f7f7d | 68 | int encoder; |
shimniok | 30:ed791f1f7f7d | 69 | int gyro[3]; |
shimniok | 32:eb673f6f5734 | 70 | int accel[3]; |
shimniok | 32:eb673f6f5734 | 71 | int mag[3]; |
shimniok | 30:ed791f1f7f7d | 72 | } SensorData; |
shimniok | 9:fc3575d2cbbf | 73 | |
shimniok | 9:fc3575d2cbbf | 74 | #endif |