Shuto Naruse
/
Eurobot2012_Secondary
Eurobot2012_Secondary
Fork of Eurobot_2012_Secondary by
Diff: globals.h
- Revision:
- 1:cc2a9eb0bd55
- Parent:
- 0:fbfafa6bf5f9
--- a/globals.h Fri Apr 20 21:32:24 2012 +0000 +++ b/globals.h Wed Oct 17 22:25:31 2012 +0000 @@ -2,35 +2,58 @@ #define GLOBALS_H #include "mbed.h" - #define PI 3.14159265 -//Robot constants -//const int encoderRevCount = 1856; -//const int wheelmm = 314; -//const int robotCircumference = 1256; + +#define ROBOT_SECONDARY -//Robot constants in mm +//enables ui +//#define UION + +#ifdef ROBOT_SECONDARY +//Secondary Robot constants in mm const int robot_width = 260; const int encoderRevCount = 360; -const int wheelmm = 226; +const int wheelmm = 229; const int robotCircumference = 816; + +#else +#define ROBOT_PRIMARY +// invert echo polarity for primary +#define SONAR_ECHO_INV +// Primary Robot constants +const int robot_width = 390; +const int encoderRevCount = 1856; +const int wheelmm = 308; +const int robotCircumference = 1150; +#endif + + + //Robot movement constants -const float fwdvarperunit = 0.005; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! -const float varperang = 3E-5; //around 1 degree stddev per 180 turn -const float xyvarpertime = 0.001; //(very poorly) accounts for hitting things +const float fwdvarperunit = 0.01; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! +const float varperang = 0.01; //around 1 degree stddev per 180 turn +const float xyvarpertime = 0.0005; //(very poorly) accounts for hitting things const float angvarpertime = 0.001; //sonar constants static const float sonarvariance = 0.005; +//IR constants +static const float IRvariance = 0.001; + //Arena constants struct pos { int x; int y; }; -const pos beaconpos[] = {{3000, 1000},{0,0}, {0,2000}}; + +//beacon positions +extern pos beaconpos[]; + +//Colour +extern bool Colour; // 1 for red, 0 for blue //System constants const int PREDICTPERIOD = 20; //ms @@ -47,15 +70,23 @@ #define RELI_BOUND_LOW 4 #define RELI_BOUND_HIGH 25 -// Localization estimate tolerences -#define POSITION_TOR 50 -#define ANGLE_TOR 0.15 +// Movement target tolerances +#define POSITION_TOR 40 // in mm +#define ANGLE_TOR 0.06 // in rad // motion control -#define MOVE_SPEED 30 +static int MOVE_SPEED = 45; #define MAX_STEP_RATIO 0.10 //maximum change in the speed //#define TRACK_RATE 10 // +- rate for each wheel when tracking +#ifdef ROBOT_PRIMARY +#define FWD_MOVE_P 18 +#define SPIN_MOVE_P 5.8 +#else +#define FWD_MOVE_P 12.4 //3.2 +#define SPIN_MOVE_P 4 +#endif + // Task suspend periods #define IR_TURRET_PERIOD 200 #define MOTION_UPDATE_PERIOD 20