Code for autonomous rover for Sparkfun AVC. DataBus won 3rd in 2012 and the same code was used on Troubled Child, a 1986 Jeep Grand Wagoneer to win 1st in 2014.

Dependencies:   mbed Watchdog SDFileSystem DigoleSerialDisp

Committer:
shimniok
Date:
Fri Nov 30 16:11:53 2018 +0000
Revision:
25:bb5356402687
Parent:
11:33757b21d0e4
Initial publish of revised version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shimniok 0:a6a169de725f 1 #ifndef __CONFIG_H
shimniok 0:a6a169de725f 2 #define __CONFIG_H
shimniok 0:a6a169de725f 3
shimniok 0:a6a169de725f 4 #include "GeoPosition.h"
shimniok 0:a6a169de725f 5 #include "CartPosition.h"
shimniok 0:a6a169de725f 6
shimniok 0:a6a169de725f 7 /** Text-based configuration; reads config file and stores in fields
shimniok 0:a6a169de725f 8 */
shimniok 0:a6a169de725f 9 class Config {
shimniok 0:a6a169de725f 10 public:
shimniok 11:33757b21d0e4 11 static const int MAX_WPT=10; // maximum number of waypoints
shimniok 11:33757b21d0e4 12
shimniok 11:33757b21d0e4 13 /** Create a new config instance */
shimniok 0:a6a169de725f 14 Config();
shimniok 0:a6a169de725f 15
shimniok 11:33757b21d0e4 16 /** Load configuration from file */
shimniok 11:33757b21d0e4 17 bool load(const char *filename);
shimniok 11:33757b21d0e4 18
shimniok 11:33757b21d0e4 19 bool loaded; // has the config been loaded yet?
shimniok 11:33757b21d0e4 20 float intercept; // used for course correction steering calculation
shimniok 11:33757b21d0e4 21 float waypointDist; // distance threshold to waypoint
shimniok 11:33757b21d0e4 22 float brakeDist; // braking distance
shimniok 11:33757b21d0e4 23 GeoPosition wpt[10]; // Waypoints, lat/lon coords
shimniok 11:33757b21d0e4 24 CartPosition cwpt[10]; // Waypoints, cartesian coords
shimniok 11:33757b21d0e4 25 float wptTopSpeedAdj[MAX_WPT]; // Speed approaching waypoint
shimniok 11:33757b21d0e4 26 float wptTurnSpeedAdj[MAX_WPT];
shimniok 11:33757b21d0e4 27 unsigned int wptCount; // number of active waypoints
shimniok 11:33757b21d0e4 28 float escMin; // minimum ESC value; brake
shimniok 11:33757b21d0e4 29 float escZero; // zero throttle
shimniok 11:33757b21d0e4 30 float escMax; // max throttle
shimniok 11:33757b21d0e4 31 float topSpeed; // default top speed to achieve on the straights
shimniok 11:33757b21d0e4 32 float turnSpeed; // default speed for turns
shimniok 11:33757b21d0e4 33 float startSpeed; // speed for start
shimniok 11:33757b21d0e4 34 float minRadius; // minimum turning radius (calculated)
shimniok 11:33757b21d0e4 35 float speedKp; // Speed PID proportional gain
shimniok 11:33757b21d0e4 36 float speedKi; // Speed PID integral gain
shimniok 11:33757b21d0e4 37 float speedKd; // Speed PID derivative gain
shimniok 11:33757b21d0e4 38 float steerZero; // zero steering aka center point
shimniok 11:33757b21d0e4 39 float steerScale; // gain factor for steering algorithm
shimniok 11:33757b21d0e4 40 float curbThreshold; // distance at which curb avoid takes place
shimniok 11:33757b21d0e4 41 float curbGain; // gain of curb avoid steering
shimniok 11:33757b21d0e4 42 // float gyroBias; // this needs to be 3d
shimniok 11:33757b21d0e4 43 float gyroScale; // scales gyro output to degrees / sec
shimniok 0:a6a169de725f 44 // float gyroScale[3];
shimniok 0:a6a169de725f 45 float magOffset[3];
shimniok 0:a6a169de725f 46 float magScale[3];
shimniok 0:a6a169de725f 47 // float accelOffset[3];
shimniok 0:a6a169de725f 48 // float accelScale[3];
shimniok 11:33757b21d0e4 49 float wheelbase; // Vehicle wheelbase, front to rear axle
shimniok 11:33757b21d0e4 50 float track; // Vehicle track width, left to right contact patch
shimniok 11:33757b21d0e4 51 float tireCirc; // tire circumference
shimniok 11:33757b21d0e4 52 int encStripes; // Number of ticks per revolution
shimniok 11:33757b21d0e4 53 float gpsValidSpeed; // speed above which GPS can be relied upon
shimniok 0:a6a169de725f 54 };
shimniok 0:a6a169de725f 55
shimniok 0:a6a169de725f 56 #endif