![](/media/cache/profiles/2012_sf_avc_095.jpg.50x50_q85.jpg)
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
Diff: Config/Config.h
- Revision:
- 11:33757b21d0e4
- Parent:
- 3:42f3821c4e54
--- a/Config/Config.h Thu Nov 29 16:27:21 2018 +0000 +++ b/Config/Config.h Thu Nov 29 16:35:31 2018 +0000 @@ -8,45 +8,49 @@ */ class Config { public: + static const int MAX_WPT=10; // maximum number of waypoints + + /** Create a new config instance */ Config(); - bool load(); - bool loaded; // has the config been loaded yet? - float interceptDist; // used for course correction steering calculation - float waypointDist; // distance threshold to waypoint - float brakeDist; // braking distance - float declination; - float compassGain; // probably don't need this anymore - float yawGain; // probably don't need this anymore - GeoPosition wpt[10]; // Waypoints, lat/lon coords - CartPosition cwpt[10]; // Waypoints, cartesian coords - unsigned int wptCount; // number of active waypoints - int escMin; // minimum ESC value; brake - int escZero; // zero throttle - int escMax; // max throttle - float topSpeed; // top speed to achieve on the straights - float turnSpeed; // speed for turns - float startSpeed; // speed for start - float minRadius; // minimum turning radius (calculated) - float speedKp; // Speed PID proportional gain - float speedKi; // Speed PID integral gain - float speedKd; // Speed PID derivative gain - float steerZero; // zero steering aka center point - float steerGain; // gain factor for steering algorithm - float steerGainAngle; // angle below which steering gain takes effect - float curbThreshold; // distance at which curb avoid takes place - float curbGain; // gain of curb avoid steering - // acceleration profile? - // braking profile? - float gyroBias; // this needs to be 3d + /** Load configuration from file */ + bool load(const char *filename); + + bool loaded; // has the config been loaded yet? + float intercept; // used for course correction steering calculation + float waypointDist; // distance threshold to waypoint + float brakeDist; // braking distance + GeoPosition wpt[10]; // Waypoints, lat/lon coords + CartPosition cwpt[10]; // Waypoints, cartesian coords + float wptTopSpeedAdj[MAX_WPT]; // Speed approaching waypoint + float wptTurnSpeedAdj[MAX_WPT]; + unsigned int wptCount; // number of active waypoints + float escMin; // minimum ESC value; brake + float escZero; // zero throttle + float escMax; // max throttle + float topSpeed; // default top speed to achieve on the straights + float turnSpeed; // default speed for turns + float startSpeed; // speed for start + float minRadius; // minimum turning radius (calculated) + float speedKp; // Speed PID proportional gain + float speedKi; // Speed PID integral gain + float speedKd; // Speed PID derivative gain + float steerZero; // zero steering aka center point + float steerScale; // gain factor for steering algorithm + float curbThreshold; // distance at which curb avoid takes place + float curbGain; // gain of curb avoid steering +// float gyroBias; // this needs to be 3d + float gyroScale; // scales gyro output to degrees / sec // float gyroScale[3]; float magOffset[3]; float magScale[3]; // float accelOffset[3]; // float accelScale[3]; - int gpsType; - int gpsBaud; - + float wheelbase; // Vehicle wheelbase, front to rear axle + float track; // Vehicle track width, left to right contact patch + float tireCirc; // tire circumference + int encStripes; // Number of ticks per revolution + float gpsValidSpeed; // speed above which GPS can be relied upon }; #endif \ No newline at end of file