Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
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; 00012 const float ENCODER_WHEELBASE = 0.068; 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.0002; //around 1 degree stddev per 180 turn //TODO: measrue this!! 00018 const float xyvarpertime = 0;//0.0005; //(very poorly) accounts for hitting things 00019 const float angvarpertime = 0;//0.001; 00020 00021 const float MOTORCONTROLLER_FILTER_K = 0.5;// TODO: tune this 00022 const float MOTOR_MAX_POWER = 0.5f; 00023 00024 /* 00025 PINOUT Sensors 00026 5: RF:SDI 00027 6 SDO 00028 7 SCK 00029 8 NCS 00030 9 NIRQ 00031 10-15 6 echo pins 00032 16 trig 00033 17 IRin 00034 18-20 unused 00035 21 stepper step 00036 22-27 unused 00037 28 Serial TX 00038 29-30 unused 00039 00040 00041 PINOUT Main 00042 5: Lower arm servo 00043 6: Upper arm servo 00044 00045 14: Serial RX 00046 15: Cake distance sensor 00047 16: Fwd distance sensor 00048 00049 20: color sensor in 00050 21-24: Motors PWM IN 1-4 00051 25-26: Encoders 00052 27-28: Encoders 00053 29: Color sensor RED LED 00054 30: Color sensor BLUE LED 00055 00056 */ 00057 00058 const PinName P_SERVO_LOWER_ARM = p5; 00059 const PinName P_SERVO_UPPER_ARM = p6; 00060 00061 const PinName P_SERIAL_RX = p14; 00062 const PinName P_DISTANCE_SENSOR = p15; 00063 const PinName P_FWD_DISTANCE_SENSOR = p16; 00064 00065 const PinName P_COLOR_SENSOR_IN_UPPER = p20; 00066 const PinName P_COLOR_SENSOR_IN_LOWER = p19; 00067 00068 const PinName P_MOT_LEFT_A = p21; 00069 const PinName P_MOT_LEFT_B = p22; 00070 const PinName P_MOT_RIGHT_A = p23; 00071 const PinName P_MOT_RIGHT_B = p24; 00072 00073 const PinName P_ENC_RIGHT_A = p26; 00074 const PinName P_ENC_RIGHT_B = p25; 00075 const PinName P_ENC_LEFT_A = p27; 00076 const PinName P_ENC_LEFT_B = p28; 00077 00078 const PinName P_COLOR_SENSOR_RED_UPPER = p29; 00079 const PinName P_COLOR_SENSOR_BLUE_UPPER = p30; 00080 const PinName P_COLOR_SENSOR_RED_LOWER = p11; 00081 const PinName P_COLOR_SENSOR_BLUE_LOWER = p10; 00082 00083 00084 00085 //a type which is a pointer to a rtos thread function 00086 typedef void (*tfuncptr_t)(void const *argument); 00087 00088 //Solving for sonar bias is done by entering the following into wolfram alpha 00089 //(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 00090 //where a, b, c are the measured distances, and f is the bias 00091 00092 //const float sonartimebias = 0; // TODO: measure and stick in the coprocessor code 00093 00094 struct pos { 00095 float x; 00096 float y; 00097 }; 00098 00099 extern pos beaconpos[3]; 00100 00101 const float PI = 3.14159265359; 00102 00103 typedef struct Waypoint 00104 { 00105 float x; 00106 float y; 00107 float theta; 00108 float pos_threshold; 00109 float angle_threshold; 00110 } Waypoint; 00111 00112 typedef struct State 00113 { 00114 float x; 00115 float y; 00116 float theta; 00117 } State; 00118 00119 #endif //GLOBALS_H
Generated on Tue Jul 12 2022 14:12:16 by 1.7.2