![](/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
util.h@0:a6a169de725f, 2013-05-27 (annotated)
- Committer:
- shimniok
- Date:
- Mon May 27 13:26:03 2013 +0000
- Revision:
- 0:a6a169de725f
- Child:
- 2:fbc6e3cf3ed8
Working version with priorities set and update time display
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shimniok | 0:a6a169de725f | 1 | #ifndef __UTIL_H |
shimniok | 0:a6a169de725f | 2 | #define __UTIL_H |
shimniok | 0:a6a169de725f | 3 | |
shimniok | 0:a6a169de725f | 4 | /** Utility routines */ |
shimniok | 0:a6a169de725f | 5 | |
shimniok | 0:a6a169de725f | 6 | #define clamp360(x) \ |
shimniok | 0:a6a169de725f | 7 | while ((x) >= 360.0) (x) -= 360.0; \ |
shimniok | 0:a6a169de725f | 8 | while ((x) < 0) (x) += 360.0; |
shimniok | 0:a6a169de725f | 9 | #define clamp180(x) ((x) - floor((x)/360.0) * 360.0 - 180.0); |
shimniok | 0:a6a169de725f | 10 | |
shimniok | 0:a6a169de725f | 11 | #ifndef M_PI |
shimniok | 0:a6a169de725f | 12 | #define M_PI 3.14159265358979323846 |
shimniok | 0:a6a169de725f | 13 | #endif |
shimniok | 0:a6a169de725f | 14 | |
shimniok | 0:a6a169de725f | 15 | /** Convert char to integer */ |
shimniok | 0:a6a169de725f | 16 | int ctoi(char c); |
shimniok | 0:a6a169de725f | 17 | /** Convert string to floating point */ |
shimniok | 0:a6a169de725f | 18 | double cvstof(char *s); |
shimniok | 0:a6a169de725f | 19 | /** Tokenize a string |
shimniok | 0:a6a169de725f | 20 | * @param s is the string to tokenize |
shimniok | 0:a6a169de725f | 21 | * @param max is the maximum number of characters |
shimniok | 0:a6a169de725f | 22 | * @param delim is the character delimiter on which to tokenize |
shimniok | 0:a6a169de725f | 23 | * @returns t is the pointer to the next token |
shimniok | 0:a6a169de725f | 24 | */ |
shimniok | 0:a6a169de725f | 25 | char *split(char *s, char *t, int max, char delim); |
shimniok | 0:a6a169de725f | 26 | |
shimniok | 0:a6a169de725f | 27 | #endif |