This is some awesome robot code
Dependencies: mbed-rtos mbed QEI
Fork of ICRSEurobot13 by
Diff: globals.h
- Revision:
- 20:70d651156779
- Parent:
- 19:4b993a9a156e
- Child:
- 22:6e3218cf75f8
- Child:
- 24:50805ef8c499
- Child:
- 43:c592bf6a6a2d
diff -r 4b993a9a156e -r 70d651156779 globals.h --- a/globals.h Sun Apr 07 19:26:07 2013 +0000 +++ b/globals.h Tue Apr 09 15:33:36 2013 +0000 @@ -1,4 +1,82 @@ +#ifndef GLOBALS_H +#define GLOBALS_H + +#include "mbed.h" + +const float KALMAN_PREDICT_PERIOD = 0.05; //seconds + +#define ENABLE_GLOBAL_ENCODERS + +const float ENCODER_M_PER_TICK = 0.00084; //TODO: measure this!! +const float ENCODER_WHEELBASE = 0.068; //TODO: measrue this!! +const float TURRET_FWD_PLACEMENT = 0.042; + +//Robot movement constants +const float fwdvarperunit = 0.01; //1 std dev = 7% //TODO: measrue this!! +const float varperang = 0.01; //around 1 degree stddev per 180 turn //TODO: measrue this!! +const float xyvarpertime = 0.0005; //(very poorly) accounts for hitting things +const float angvarpertime = 0.001; + +/* +PINOUT Sensors +5: RF:SDI +6 SDO +7 SCK +8 NCS +9 NIRQ +10-15 6 echo pins +16 trig +17 IRin +18-20 unused +21 stepper step +22-27 unused +28 Serial TX +29-30 unused + + +PINOUT Main +5: Lower arm servo +6: Upper arm servo + +14: Serial RX +15: Cake distance sensor +16: Fwd distance sensor + +20: color sensor in +21-24: Motors PWM IN 1-4 +25-26: Encoders +27-28: Encoders +29: Color sensor RED LED +30: Color sensor BLUE LED + +*/ + +const PinName P_SERVO_LOWER_ARM = p5; +const PinName P_SERVO_UPPER_ARM = p6; + +const PinName P_SERIAL_RX = p14; +const PinName P_DISTANCE_SENSOR = p15; + +const PinName P_COLOR_SENSOR_IN = p20; + +const PinName P_MOT_RIGHT_A = p21; +const PinName P_MOT_RIGHT_B = p22; +const PinName P_MOT_LEFT_A = p23; +const PinName P_MOT_LEFT_B = p24; + +const PinName P_ENC_RIGHT_A = p28; +const PinName P_ENC_RIGHT_B = p27; +const PinName P_ENC_LEFT_A = p25; +const PinName P_ENC_LEFT_B = p26; + +const PinName P_COLOR_SENSOR_RED = p29; +const PinName P_COLOR_SENSOR_BLUE = p30; + + + +//a type which is a pointer to a rtos thread function +typedef void (*tfuncptr_t)(void const *argument); //Solving for sonar bias is done by entering the following into wolfram alpha //(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 @@ -13,4 +91,6 @@ extern pos beaconpos[3]; -const float PI = 3.14159265359; \ No newline at end of file +const float PI = 3.14159265359; + +#endif //GLOBALS_H \ No newline at end of file