Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
SystemState.h@0:826c6171fc1b, 2012-06-20 (annotated)
- Committer:
- shimniok
- Date:
- Wed Jun 20 14:57:48 2012 +0000
- Revision:
- 0:826c6171fc1b
Updated documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:826c6171fc1b | 1 | #ifndef _SYSTEMSTATE_H |
shimniok | 0:826c6171fc1b | 2 | #define _SYSTEMSTATE_H |
shimniok | 0:826c6171fc1b | 3 | |
shimniok | 0:826c6171fc1b | 4 | #define SSBUF 0x2F |
shimniok | 0:826c6171fc1b | 5 | |
shimniok | 0:826c6171fc1b | 6 | /** System State is the main mechanism for communicating current realtime system state to |
shimniok | 0:826c6171fc1b | 7 | * the rest of the system for logging, data display, etc. |
shimniok | 0:826c6171fc1b | 8 | */ |
shimniok | 0:826c6171fc1b | 9 | |
shimniok | 0:826c6171fc1b | 10 | /* struct systemState |
shimniok | 0:826c6171fc1b | 11 | * structure containing system sensor data |
shimniok | 0:826c6171fc1b | 12 | ****** System Status |
shimniok | 0:826c6171fc1b | 13 | * millis number of milliseconds since epoch (or startup) |
shimniok | 0:826c6171fc1b | 14 | * current current draw in amps |
shimniok | 0:826c6171fc1b | 15 | * voltage voltage in volts |
shimniok | 0:826c6171fc1b | 16 | ****** Data reported by IMU |
shimniok | 0:826c6171fc1b | 17 | * g[3] raw 3-axis gyro values; if using 1-axis, then store data in gx |
shimniok | 0:826c6171fc1b | 18 | * gTemp Gyro temperature |
shimniok | 0:826c6171fc1b | 19 | * a[3] raw 3-axis accelerometer values |
shimniok | 0:826c6171fc1b | 20 | * m[3] raw 3-axis magnetometer values; if using 2d then store data in mx and my |
shimniok | 0:826c6171fc1b | 21 | * gHeading independently calculated gyro heading in degrees |
shimniok | 0:826c6171fc1b | 22 | * cHeading independently calculated compass heading in degrees |
shimniok | 0:826c6171fc1b | 23 | ****** AHRS Estimates |
shimniok | 0:826c6171fc1b | 24 | * roll, pitch, yaw estimated attitude in degrees relative to the world frame |
shimniok | 0:826c6171fc1b | 25 | ****** Data reported by GPS |
shimniok | 0:826c6171fc1b | 26 | * gpsLatitude raw GPS latitude in fractional degrees (e.g., 39.123456) |
shimniok | 0:826c6171fc1b | 27 | * gpsLongitude raw GPS longitude in fractional degrees (e.g., -104.123456 |
shimniok | 0:826c6171fc1b | 28 | * gpsCourse raw GPS course in degrees |
shimniok | 0:826c6171fc1b | 29 | * gpsSpeed raw GPS speed in mph |
shimniok | 0:826c6171fc1b | 30 | * gpsHDOP raw GPS Horizontal Dilution of Precision |
shimniok | 0:826c6171fc1b | 31 | ****** Odometry data |
shimniok | 0:826c6171fc1b | 32 | * lrEncDistance left rear encoder distance since last log update |
shimniok | 0:826c6171fc1b | 33 | * rrEncDistance right rear encoder distance since last log update |
shimniok | 0:826c6171fc1b | 34 | * lrEncSpeed left rear encoder speed |
shimniok | 0:826c6171fc1b | 35 | * rrEncSpeed right rear encoder speed |
shimniok | 0:826c6171fc1b | 36 | * encHeading estimated heading based on encoder readings |
shimniok | 0:826c6171fc1b | 37 | ****** Estimated Position and Heading |
shimniok | 0:826c6171fc1b | 38 | * estHeading estimated heading in degrees, this is the robot's reference for heading |
shimniok | 0:826c6171fc1b | 39 | * estLatitude estimated latitude in fractional degrees (e.g., 39.123456) |
shimniok | 0:826c6171fc1b | 40 | * estLongitude estimated longitude in fractional degrees (e.g., -104.123456) |
shimniok | 0:826c6171fc1b | 41 | * estNorthing some algorithms use UTM. Estimated UTM northing |
shimniok | 0:826c6171fc1b | 42 | * estEasting estimated UTM easting |
shimniok | 0:826c6171fc1b | 43 | * estX, estY some algorithms use simple x, y distance from origin (meters) |
shimniok | 0:826c6171fc1b | 44 | ****** Waypoint data |
shimniok | 0:826c6171fc1b | 45 | * nextWaypoint integer ID of the next waypoint |
shimniok | 0:826c6171fc1b | 46 | * bearing estimated bearing to next waypoint in degrees |
shimniok | 0:826c6171fc1b | 47 | * distance estimated distance to next waypoint in meters |
shimniok | 0:826c6171fc1b | 48 | ****** Control data |
shimniok | 0:826c6171fc1b | 49 | * throttle raw servo setting(units?) |
shimniok | 0:826c6171fc1b | 50 | * steering raw servo setting(units?) |
shimniok | 0:826c6171fc1b | 51 | */ |
shimniok | 0:826c6171fc1b | 52 | typedef struct { |
shimniok | 0:826c6171fc1b | 53 | unsigned int millis; |
shimniok | 0:826c6171fc1b | 54 | float current, voltage; |
shimniok | 0:826c6171fc1b | 55 | int g[3]; |
shimniok | 0:826c6171fc1b | 56 | int gTemp; |
shimniok | 0:826c6171fc1b | 57 | int a[3]; |
shimniok | 0:826c6171fc1b | 58 | int m[3]; |
shimniok | 0:826c6171fc1b | 59 | float gHeading; |
shimniok | 0:826c6171fc1b | 60 | float cHeading; |
shimniok | 0:826c6171fc1b | 61 | //float roll, pitch, yaw; |
shimniok | 0:826c6171fc1b | 62 | double gpsLatitude; |
shimniok | 0:826c6171fc1b | 63 | double gpsLongitude; |
shimniok | 0:826c6171fc1b | 64 | float gpsCourse; |
shimniok | 0:826c6171fc1b | 65 | float gpsSpeed; |
shimniok | 0:826c6171fc1b | 66 | float gpsHDOP; |
shimniok | 0:826c6171fc1b | 67 | int gpsSats; |
shimniok | 0:826c6171fc1b | 68 | float lrEncDistance, rrEncDistance; |
shimniok | 0:826c6171fc1b | 69 | float lrEncSpeed, rrEncSpeed; |
shimniok | 0:826c6171fc1b | 70 | float encHeading; |
shimniok | 0:826c6171fc1b | 71 | float estHeading; |
shimniok | 0:826c6171fc1b | 72 | double estLatitude, estLongitude; |
shimniok | 0:826c6171fc1b | 73 | //double estNorthing, estEasting; |
shimniok | 0:826c6171fc1b | 74 | float estX, estY; |
shimniok | 0:826c6171fc1b | 75 | unsigned short nextWaypoint; |
shimniok | 0:826c6171fc1b | 76 | float bearing; |
shimniok | 0:826c6171fc1b | 77 | float distance; |
shimniok | 0:826c6171fc1b | 78 | float gbias; |
shimniok | 0:826c6171fc1b | 79 | float errAngle; |
shimniok | 0:826c6171fc1b | 80 | float leftRanger; |
shimniok | 0:826c6171fc1b | 81 | float rightRanger; |
shimniok | 0:826c6171fc1b | 82 | float centerRanger; |
shimniok | 0:826c6171fc1b | 83 | float crossTrackErr; |
shimniok | 0:826c6171fc1b | 84 | } SystemState; |
shimniok | 0:826c6171fc1b | 85 | |
shimniok | 0:826c6171fc1b | 86 | #endif |