Code for autonomous ground vehicle, Data Bus, 3rd place winner in 2012 Sparkfun AVC.
Dependencies: Watchdog mbed Schedule SimpleFilter LSM303DLM PinDetect DebounceIn Servo
util.h
00001 #ifndef __UTIL_H 00002 #define __UTIL_H 00003 00004 /** Utility routines */ 00005 00006 #define clamp360(x) \ 00007 while ((x) >= 360.0) (x) -= 360.0; \ 00008 while ((x) < 0) (x) += 360.0; 00009 #define clamp180(x) ((x) - floor((x)/360.0) * 360.0 - 180.0); 00010 00011 #ifndef M_PI 00012 #define M_PI 3.14159265358979323846 00013 #endif 00014 00015 /** Convert char to integer */ 00016 int ctoi(char c); 00017 /** Convert string to floating point */ 00018 double cvstof(char *s); 00019 /** Tokenize a string 00020 * @param s is the string to tokenize 00021 * @param max is the maximum number of characters 00022 * @param delim is the character delimiter on which to tokenize 00023 * @returns t is the pointer to the next token 00024 */ 00025 char *split(char *s, char *t, int max, char delim); 00026 00027 #endif
Generated on Tue Jul 12 2022 14:09:28 by 1.7.2