Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
globals.h
00001 #ifndef GLOBALS_H 00002 #define GLOBALS_H 00003 00004 #include "mbed.h" 00005 #define PI 3.14159265 00006 00007 00008 //#define ROBOT_SECONDARY 00009 00010 //enables ui 00011 //#define UION 00012 00013 #ifdef ROBOT_SECONDARY 00014 //Secondary Robot constants in mm 00015 const int robot_width = 260; 00016 const int encoderRevCount = 360; 00017 const int wheelmm = 229; 00018 const int robotCircumference = 816; 00019 00020 00021 #else 00022 #define ROBOT_PRIMARY 00023 // invert echo polarity for primary 00024 #define SONAR_ECHO_INV 00025 // Primary Robot constants 00026 const int robot_width = 390; 00027 const int encoderRevCount = 1856; 00028 const int wheelmm = 308; 00029 const int robotCircumference = 1150; 00030 #endif 00031 00032 00033 00034 //Robot movement constants 00035 const float fwdvarperunit = 0.01; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! 00036 const float varperang = 0.01; //around 1 degree stddev per 180 turn 00037 const float xyvarpertime = 0.0005; //(very poorly) accounts for hitting things 00038 const float angvarpertime = 0.001; 00039 00040 //sonar constants 00041 static const float sonarvariance = 0.005; 00042 00043 //IR constants 00044 static const float IRvariance = 0.001; 00045 00046 //Arena constants 00047 struct pos { 00048 int x; 00049 int y; 00050 }; 00051 00052 //beacon positions 00053 extern pos beaconpos[]; 00054 00055 //Colour 00056 extern bool Colour; // 1 for red, 0 for blue 00057 00058 //System constants 00059 const int PREDICTPERIOD = 20; //ms 00060 00061 //High speed serial port 00062 extern Serial pc; 00063 00064 //I2C mutex 00065 //extern Mutex i2c_rlock; 00066 //extern Mutex i2c_wlock; 00067 00068 00069 // IR angle calc 00070 #define RELI_BOUND_LOW 4 00071 #define RELI_BOUND_HIGH 25 00072 00073 // Movement target tolerances 00074 #define POSITION_TOR 20 // in mm 00075 #define ANGLE_TOR 0.06 // in rad 00076 00077 // motion control 00078 00079 #ifndef MOVE_SPEED_DEF 00080 #define MOVE_SPEED_DEF 00081 static int MOVE_SPEED = 35; 00082 #endif 00083 00084 #define MAX_STEP_RATIO 0.10 //maximum change in the speed 00085 //#define TRACK_RATE 10 // +- rate for each wheel when tracking 00086 00087 #ifdef ROBOT_PRIMARY 00088 #define FWD_MOVE_P 20//18 00089 #define SPIN_MOVE_P 7//5.8 00090 #else 00091 #define FWD_MOVE_P 3.2 00092 #define SPIN_MOVE_P 4 00093 #endif 00094 00095 // Task suspend periods 00096 #define IR_TURRET_PERIOD 200 00097 #define MOTION_UPDATE_PERIOD 20 00098 00099 #endif
Generated on Tue Jul 12 2022 21:49:57 by 1.7.2