ICRS Eurobot 2013

Dependencies:   mbed mbed-rtos Servo QEI

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers globals.h Source File

globals.h

00001 
00002 #ifndef GLOBALS_H
00003 #define GLOBALS_H
00004 
00005 #include "mbed.h"
00006 
00007 const float KALMAN_PREDICT_PERIOD = 0.05; //seconds
00008 
00009 #define ENABLE_GLOBAL_ENCODERS
00010 
00011 const float ENCODER_M_PER_TICK = 0.00084; //TODO: measure this!!
00012 const float ENCODER_WHEELBASE = 0.068; //TODO: measrue this!!
00013 const float TURRET_FWD_PLACEMENT = 0.042;
00014 
00015 //Robot movement constants
00016 const float fwdvarperunit = 0.01; //1 std dev = 7% //TODO: measrue this!!
00017 const float varperang = 0.01; //around 1 degree stddev per 180 turn //TODO: measrue this!!
00018 const float xyvarpertime = 0.0005; //(very poorly) accounts for hitting things
00019 const float angvarpertime = 0.001;
00020 
00021 /*
00022 PINOUT Sensors
00023 5:  RF:SDI
00024 6 SDO
00025 7 SCK
00026 8 NCS
00027 9 NIRQ
00028 10-15 6 echo pins
00029 16 trig
00030 17 IRin
00031 18-20 unused
00032 21 stepper step
00033 22-27 unused
00034 28 Serial TX
00035 29-30 unused
00036 
00037 
00038 PINOUT Main
00039 5: Lower arm servo
00040 6: Upper arm servo
00041 
00042 14: Serial RX
00043 15: Cake distance sensor
00044 16: Fwd distance sensor
00045 
00046 20: color sensor in
00047 21-24: Motors PWM IN 1-4
00048 25-26: Encoders 
00049 27-28: Encoders 
00050 29: Color sensor RED LED
00051 30: Color sensor BLUE LED
00052 
00053 */
00054 
00055 const PinName P_SERVO_LOWER_ARM = p5;
00056 const PinName P_SERVO_UPPER_ARM = p6;
00057 
00058 const PinName P_SERIAL_RX       = p14;
00059 const PinName P_DISTANCE_SENSOR = p15;
00060 
00061 const PinName P_COLOR_SENSOR_IN = p20;
00062 
00063 const PinName P_MOT_RIGHT_A     = p21;
00064 const PinName P_MOT_RIGHT_B     = p22;
00065 const PinName P_MOT_LEFT_A      = p23;
00066 const PinName P_MOT_LEFT_B      = p24;
00067 
00068 const PinName P_ENC_RIGHT_A     = p28;
00069 const PinName P_ENC_RIGHT_B     = p27;
00070 const PinName P_ENC_LEFT_A      = p25;
00071 const PinName P_ENC_LEFT_B      = p26;
00072 
00073 const PinName P_COLOR_SENSOR_RED = p29;
00074 const PinName P_COLOR_SENSOR_BLUE = p30;
00075 
00076 
00077 
00078 //a type which is a pointer to a rtos thread function
00079 typedef void (*tfuncptr_t)(void const *argument);
00080 
00081 //Solving for sonar bias is done by entering the following into wolfram alpha
00082 //(a-f)^2 = x^2 + y^2; (b-f)^2 = (x-3)^2 + y^2; (c-f)^2 = (x-1.5)^2+(y-2)^2: solve for x,y,f
00083 //where a, b, c are the measured distances, and f is the bias
00084 
00085 //const float sonartimebias = 0; // TODO: measure and stick in the coprocessor code
00086 
00087 struct pos {
00088     float x;
00089     float y;
00090 };
00091 
00092 extern pos beaconpos[3];
00093 
00094 const float PI = 3.14159265359;
00095 
00096 #endif //GLOBALS_H