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
Updater.h@25:bb5356402687, 2018-11-30 (annotated)
- Committer:
- shimniok
- Date:
- Fri Nov 30 16:11:53 2018 +0000
- Revision:
- 25:bb5356402687
- Parent:
- 22:dc54ca6e6eec
Initial publish of revised version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:a6a169de725f | 1 | #ifndef __SCHEDULER_H |
shimniok | 0:a6a169de725f | 2 | #define __SCHEDULER_H |
shimniok | 0:a6a169de725f | 3 | |
shimniok | 0:a6a169de725f | 4 | /** Updater is the main real time sensor update, estimation, and control routine that is |
shimniok | 0:a6a169de725f | 5 | * called at 100Hz by a timer interrupt |
shimniok | 0:a6a169de725f | 6 | */ |
shimniok | 22:dc54ca6e6eec | 7 | class Updater { |
shimniok | 22:dc54ca6e6eec | 8 | public: |
shimniok | 0:a6a169de725f | 9 | |
shimniok | 22:dc54ca6e6eec | 10 | /** attach the update routine to Ticker interrupt */ |
shimniok | 22:dc54ca6e6eec | 11 | void start(void); |
shimniok | 15:01fb4916a5cd | 12 | |
shimniok | 22:dc54ca6e6eec | 13 | /** detach the update routine from Ticker interrupt */ |
shimniok | 22:dc54ca6e6eec | 14 | void stop(void); |
shimniok | 0:a6a169de725f | 15 | |
shimniok | 22:dc54ca6e6eec | 16 | /** Tells the updater to re-initialize the navigation state */ |
shimniok | 22:dc54ca6e6eec | 17 | void restartNav(void); |
shimniok | 15:01fb4916a5cd | 18 | |
shimniok | 22:dc54ca6e6eec | 19 | /** Indicates to the updater that the vehicle should begin its run */ |
shimniok | 22:dc54ca6e6eec | 20 | void beginRun(void); |
shimniok | 0:a6a169de725f | 21 | |
shimniok | 22:dc54ca6e6eec | 22 | /** Indicates to the updater that the vehicle should abort its run */ |
shimniok | 22:dc54ca6e6eec | 23 | void endRun(void); |
shimniok | 22:dc54ca6e6eec | 24 | |
shimniok | 22:dc54ca6e6eec | 25 | /** Returns the elapsed time taken by the updater routine on its most recent run */ |
shimniok | 22:dc54ca6e6eec | 26 | int getUpdateTime(void); |
shimniok | 0:a6a169de725f | 27 | |
shimniok | 22:dc54ca6e6eec | 28 | /** Sets the desired speed of the rover */ |
shimniok | 22:dc54ca6e6eec | 29 | void setSpeed(float speed); |
shimniok | 22:dc54ca6e6eec | 30 | |
shimniok | 22:dc54ca6e6eec | 31 | /** The function that is called at 100Hz. It reads sensors, performs estimation, and controls the robot */ |
shimniok | 22:dc54ca6e6eec | 32 | void update(void); |
shimniok | 22:dc54ca6e6eec | 33 | |
shimniok | 22:dc54ca6e6eec | 34 | /** initialize throttle to center position */ |
shimniok | 22:dc54ca6e6eec | 35 | void initThrottle(void); |
shimniok | 15:01fb4916a5cd | 36 | |
shimniok | 22:dc54ca6e6eec | 37 | /** initialize steering to center position */ |
shimniok | 22:dc54ca6e6eec | 38 | void initSteering(void); |
shimniok | 15:01fb4916a5cd | 39 | |
shimniok | 22:dc54ca6e6eec | 40 | /** Sets the steering angle */ |
shimniok | 22:dc54ca6e6eec | 41 | void setSteering(float steerAngle); |
shimniok | 22:dc54ca6e6eec | 42 | |
shimniok | 22:dc54ca6e6eec | 43 | } |
shimniok | 0:a6a169de725f | 44 | |
shimniok | 0:a6a169de725f | 45 | #endif |