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
00001 #ifndef _SYSTEMSTATE_H 00002 #define _SYSTEMSTATE_H 00003 00004 #define SSBUF 0x2F 00005 00006 /** System State is the main mechanism for communicating current realtime system state to 00007 * the rest of the system for logging, data display, etc. 00008 */ 00009 00010 /* struct systemState 00011 * structure containing system sensor data 00012 ****** System Status 00013 * millis number of milliseconds since epoch (or startup) 00014 * current current draw in amps 00015 * voltage voltage in volts 00016 ****** Data reported by IMU 00017 * g[3] raw 3-axis gyro values; if using 1-axis, then store data in gx 00018 * gTemp Gyro temperature 00019 * a[3] raw 3-axis accelerometer values 00020 * m[3] raw 3-axis magnetometer values; if using 2d then store data in mx and my 00021 * gHeading independently calculated gyro heading in degrees 00022 * cHeading independently calculated compass heading in degrees 00023 ****** AHRS Estimates 00024 * roll, pitch, yaw estimated attitude in degrees relative to the world frame 00025 ****** Data reported by GPS 00026 * gpsLatitude raw GPS latitude in fractional degrees (e.g., 39.123456) 00027 * gpsLongitude raw GPS longitude in fractional degrees (e.g., -104.123456 00028 * gpsCourse raw GPS course in degrees 00029 * gpsSpeed raw GPS speed in mph 00030 * gpsHDOP raw GPS Horizontal Dilution of Precision 00031 ****** Odometry data 00032 * lrEncDistance left rear encoder distance since last log update 00033 * rrEncDistance right rear encoder distance since last log update 00034 * lrEncSpeed left rear encoder speed 00035 * rrEncSpeed right rear encoder speed 00036 * encHeading estimated heading based on encoder readings 00037 ****** Estimated Position and Heading 00038 * estHeading estimated heading in degrees, this is the robot's reference for heading 00039 * estLatitude estimated latitude in fractional degrees (e.g., 39.123456) 00040 * estLongitude estimated longitude in fractional degrees (e.g., -104.123456) 00041 * estNorthing some algorithms use UTM. Estimated UTM northing 00042 * estEasting estimated UTM easting 00043 * estX, estY some algorithms use simple x, y distance from origin (meters) 00044 ****** Waypoint data 00045 * nextWaypoint integer ID of the next waypoint 00046 * bearing estimated bearing to next waypoint in degrees 00047 * distance estimated distance to next waypoint in meters 00048 ****** Control data 00049 * throttle raw servo setting(units?) 00050 * steering raw servo setting(units?) 00051 */ 00052 typedef struct { 00053 unsigned int millis; 00054 float current, voltage; 00055 int g[3]; 00056 int gTemp; 00057 int a[3]; 00058 int m[3]; 00059 float gHeading; 00060 float cHeading; 00061 //float roll, pitch, yaw; 00062 double gpsLatitude; 00063 double gpsLongitude; 00064 float gpsCourse; 00065 float gpsSpeed; 00066 float gpsHDOP; 00067 int gpsSats; 00068 float lrEncDistance, rrEncDistance; 00069 float lrEncSpeed, rrEncSpeed; 00070 float encHeading; 00071 float estHeading; 00072 double estLatitude, estLongitude; 00073 //double estNorthing, estEasting; 00074 float estX, estY; 00075 unsigned short nextWaypoint; 00076 float bearing; 00077 float distance; 00078 float gbias; 00079 float errAngle; 00080 float leftRanger; 00081 float rightRanger; 00082 float centerRanger; 00083 float crossTrackErr; 00084 } SystemState; 00085 00086 #endif
Generated on Tue Jul 12 2022 14:09:28 by 1.7.2