Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
globals.h@1:bbabbd997d21, 2012-04-20 (annotated)
- Committer:
- narshu
- Date:
- Fri Apr 20 21:56:15 2012 +0000
- Revision:
- 1:bbabbd997d21
- Parent:
- 0:f3bf6c7e2283
- Child:
- 2:cffa347bb943
copied everything from secondary;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
narshu | 0:f3bf6c7e2283 | 1 | #ifndef GLOBALS_H |
narshu | 0:f3bf6c7e2283 | 2 | #define GLOBALS_H |
narshu | 0:f3bf6c7e2283 | 3 | |
narshu | 0:f3bf6c7e2283 | 4 | #include "mbed.h" |
narshu | 0:f3bf6c7e2283 | 5 | |
narshu | 0:f3bf6c7e2283 | 6 | #define PI 3.14159265 |
narshu | 0:f3bf6c7e2283 | 7 | |
narshu | 0:f3bf6c7e2283 | 8 | //Robot constants |
narshu | 1:bbabbd997d21 | 9 | const int robot_width = 395; |
narshu | 1:bbabbd997d21 | 10 | const int encoderRevCount = 1856; |
narshu | 1:bbabbd997d21 | 11 | const int wheelmm = 314; |
narshu | 1:bbabbd997d21 | 12 | const int robotCircumference = 1256; |
narshu | 0:f3bf6c7e2283 | 13 | |
narshu | 0:f3bf6c7e2283 | 14 | //Robot constants in mm |
narshu | 1:bbabbd997d21 | 15 | //const int robot_width = 260; |
narshu | 1:bbabbd997d21 | 16 | //const int encoderRevCount = 360; |
narshu | 1:bbabbd997d21 | 17 | //const int wheelmm = 226; |
narshu | 1:bbabbd997d21 | 18 | //const int robotCircumference = 816; |
narshu | 1:bbabbd997d21 | 19 | |
narshu | 1:bbabbd997d21 | 20 | //Robot movement constants |
narshu | 1:bbabbd997d21 | 21 | const float fwdvarperunit = 0.005; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! |
narshu | 1:bbabbd997d21 | 22 | const float varperang = 3E-5; //around 1 degree stddev per 180 turn |
narshu | 1:bbabbd997d21 | 23 | const float xyvarpertime = 0.001; //(very poorly) accounts for hitting things |
narshu | 1:bbabbd997d21 | 24 | const float angvarpertime = 0.001; |
narshu | 1:bbabbd997d21 | 25 | |
narshu | 1:bbabbd997d21 | 26 | //sonar constants |
narshu | 1:bbabbd997d21 | 27 | static const float sonarvariance = 0.005; |
narshu | 0:f3bf6c7e2283 | 28 | |
narshu | 0:f3bf6c7e2283 | 29 | //Arena constants |
narshu | 0:f3bf6c7e2283 | 30 | struct pos { |
narshu | 0:f3bf6c7e2283 | 31 | int x; |
narshu | 0:f3bf6c7e2283 | 32 | int y; |
narshu | 0:f3bf6c7e2283 | 33 | }; |
narshu | 0:f3bf6c7e2283 | 34 | const pos beaconpos[] = {{3000, 1000},{0,0}, {0,2000}}; |
narshu | 0:f3bf6c7e2283 | 35 | |
narshu | 1:bbabbd997d21 | 36 | //System constants |
narshu | 1:bbabbd997d21 | 37 | const int PREDICTPERIOD = 20; //ms |
narshu | 0:f3bf6c7e2283 | 38 | |
narshu | 0:f3bf6c7e2283 | 39 | //High speed serial port |
narshu | 0:f3bf6c7e2283 | 40 | extern Serial pc; |
narshu | 0:f3bf6c7e2283 | 41 | |
narshu | 0:f3bf6c7e2283 | 42 | //I2C mutex |
narshu | 0:f3bf6c7e2283 | 43 | //extern Mutex i2c_rlock; |
narshu | 0:f3bf6c7e2283 | 44 | //extern Mutex i2c_wlock; |
narshu | 0:f3bf6c7e2283 | 45 | |
narshu | 0:f3bf6c7e2283 | 46 | |
narshu | 0:f3bf6c7e2283 | 47 | // IR angle calc |
narshu | 0:f3bf6c7e2283 | 48 | #define RELI_BOUND_LOW 4 |
narshu | 0:f3bf6c7e2283 | 49 | #define RELI_BOUND_HIGH 25 |
narshu | 0:f3bf6c7e2283 | 50 | |
narshu | 1:bbabbd997d21 | 51 | // Localization estimate tolerences |
narshu | 1:bbabbd997d21 | 52 | #define POSITION_TOR 50 |
narshu | 0:f3bf6c7e2283 | 53 | #define ANGLE_TOR 0.15 |
narshu | 0:f3bf6c7e2283 | 54 | |
narshu | 0:f3bf6c7e2283 | 55 | // motion control |
narshu | 1:bbabbd997d21 | 56 | #define MOVE_SPEED 30 |
narshu | 0:f3bf6c7e2283 | 57 | #define MAX_STEP_RATIO 0.10 //maximum change in the speed |
narshu | 0:f3bf6c7e2283 | 58 | //#define TRACK_RATE 10 // +- rate for each wheel when tracking |
narshu | 0:f3bf6c7e2283 | 59 | |
narshu | 0:f3bf6c7e2283 | 60 | // Task suspend periods |
narshu | 0:f3bf6c7e2283 | 61 | #define IR_TURRET_PERIOD 200 |
narshu | 0:f3bf6c7e2283 | 62 | #define MOTION_UPDATE_PERIOD 20 |
narshu | 0:f3bf6c7e2283 | 63 | |
narshu | 0:f3bf6c7e2283 | 64 | #endif |