Eurobot2012_Primary
Dependencies: mbed Eurobot_2012_Primary
globals.h@13:57ea4e520dbd, 2012-04-28 (annotated)
- Committer:
- narshu
- Date:
- Sat Apr 28 19:39:08 2012 +0000
- Revision:
- 13:57ea4e520dbd
- Parent:
- 10:294b9adbc9d3
- Child:
- 14:24f994dc2770
PID tuned. Modified ai signalling logic at target location.
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 | 9:377560539b74 | 4 | #include "mbed.h" |
narshu | 9:377560539b74 | 5 | #define PI 3.14159265 |
narshu | 9:377560539b74 | 6 | |
narshu | 2:cffa347bb943 | 7 | //#define ROBOT_SECONDARY |
narshu | 2:cffa347bb943 | 8 | |
narshu | 9:377560539b74 | 9 | #ifdef ROBOT_SECONDARY |
narshu | 5:7ac07bf30707 | 10 | //Secondary Robot constants in mm |
narshu | 5:7ac07bf30707 | 11 | const int robot_width = 260; |
narshu | 5:7ac07bf30707 | 12 | const int encoderRevCount = 360; |
narshu | 5:7ac07bf30707 | 13 | const int wheelmm = 226; |
narshu | 5:7ac07bf30707 | 14 | const int robotCircumference = 816; |
narshu | 0:f3bf6c7e2283 | 15 | |
narshu | 5:7ac07bf30707 | 16 | |
narshu | 9:377560539b74 | 17 | #else |
narshu | 9:377560539b74 | 18 | #define ROBOT_PRIMARY |
narshu | 9:377560539b74 | 19 | // invert echo polarity for primary |
narshu | 9:377560539b74 | 20 | #define SONAR_ECHO_INV |
narshu | 9:377560539b74 | 21 | // Primary Robot constants |
narshu | 9:377560539b74 | 22 | const int robot_width = 390; |
narshu | 9:377560539b74 | 23 | const int encoderRevCount = 1856; |
narshu | 9:377560539b74 | 24 | const int wheelmm = 304; |
narshu | 9:377560539b74 | 25 | const int robotCircumference = 1150; |
narshu | 9:377560539b74 | 26 | #endif |
narshu | 0:f3bf6c7e2283 | 27 | |
narshu | 5:7ac07bf30707 | 28 | |
narshu | 1:bbabbd997d21 | 29 | |
narshu | 1:bbabbd997d21 | 30 | //Robot movement constants |
narshu | 9:377560539b74 | 31 | const float fwdvarperunit = 0.008; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! |
narshu | 9:377560539b74 | 32 | const float varperang = 0.005; //around 1 degree stddev per 180 turn |
narshu | 10:294b9adbc9d3 | 33 | const float xyvarpertime = 0;//0.0005; //(very poorly) accounts for hitting things |
narshu | 10:294b9adbc9d3 | 34 | const float angvarpertime = 0;//0.001; |
narshu | 1:bbabbd997d21 | 35 | |
narshu | 1:bbabbd997d21 | 36 | //sonar constants |
narshu | 1:bbabbd997d21 | 37 | static const float sonarvariance = 0.005; |
narshu | 0:f3bf6c7e2283 | 38 | |
narshu | 9:377560539b74 | 39 | //IR constants |
narshu | 9:377560539b74 | 40 | static const float IRvariance = 0.001; |
narshu | 9:377560539b74 | 41 | |
narshu | 0:f3bf6c7e2283 | 42 | //Arena constants |
narshu | 0:f3bf6c7e2283 | 43 | struct pos { |
narshu | 0:f3bf6c7e2283 | 44 | int x; |
narshu | 0:f3bf6c7e2283 | 45 | int y; |
narshu | 0:f3bf6c7e2283 | 46 | }; |
narshu | 0:f3bf6c7e2283 | 47 | const pos beaconpos[] = {{3000, 1000},{0,0}, {0,2000}}; |
narshu | 0:f3bf6c7e2283 | 48 | |
narshu | 1:bbabbd997d21 | 49 | //System constants |
narshu | 1:bbabbd997d21 | 50 | const int PREDICTPERIOD = 20; //ms |
narshu | 0:f3bf6c7e2283 | 51 | |
narshu | 0:f3bf6c7e2283 | 52 | //High speed serial port |
narshu | 0:f3bf6c7e2283 | 53 | extern Serial pc; |
narshu | 0:f3bf6c7e2283 | 54 | |
narshu | 0:f3bf6c7e2283 | 55 | //I2C mutex |
narshu | 0:f3bf6c7e2283 | 56 | //extern Mutex i2c_rlock; |
narshu | 0:f3bf6c7e2283 | 57 | //extern Mutex i2c_wlock; |
narshu | 0:f3bf6c7e2283 | 58 | |
narshu | 0:f3bf6c7e2283 | 59 | |
narshu | 0:f3bf6c7e2283 | 60 | // IR angle calc |
narshu | 0:f3bf6c7e2283 | 61 | #define RELI_BOUND_LOW 4 |
narshu | 0:f3bf6c7e2283 | 62 | #define RELI_BOUND_HIGH 25 |
narshu | 0:f3bf6c7e2283 | 63 | |
narshu | 10:294b9adbc9d3 | 64 | // Movement target tolerances |
narshu | 1:bbabbd997d21 | 65 | #define POSITION_TOR 50 |
narshu | 10:294b9adbc9d3 | 66 | #define ANGLE_TOR 0.1 |
narshu | 0:f3bf6c7e2283 | 67 | |
narshu | 0:f3bf6c7e2283 | 68 | // motion control |
narshu | 10:294b9adbc9d3 | 69 | #define MOVE_SPEED 30 |
narshu | 0:f3bf6c7e2283 | 70 | #define MAX_STEP_RATIO 0.10 //maximum change in the speed |
narshu | 0:f3bf6c7e2283 | 71 | //#define TRACK_RATE 10 // +- rate for each wheel when tracking |
narshu | 0:f3bf6c7e2283 | 72 | |
narshu | 10:294b9adbc9d3 | 73 | #ifdef ROBOT_PRIMARY |
narshu | 13:57ea4e520dbd | 74 | #define FWD_MOVE_P 16 |
narshu | 13:57ea4e520dbd | 75 | #define SPIN_MOVE_P 5.8 |
narshu | 10:294b9adbc9d3 | 76 | #else |
narshu | 10:294b9adbc9d3 | 77 | #define FWD_MOVE_P 3.2 |
narshu | 10:294b9adbc9d3 | 78 | #define SPIN_MOVE_P 4 |
narshu | 10:294b9adbc9d3 | 79 | #endif |
narshu | 10:294b9adbc9d3 | 80 | |
narshu | 0:f3bf6c7e2283 | 81 | // Task suspend periods |
narshu | 0:f3bf6c7e2283 | 82 | #define IR_TURRET_PERIOD 200 |
narshu | 0:f3bf6c7e2283 | 83 | #define MOTION_UPDATE_PERIOD 20 |
narshu | 0:f3bf6c7e2283 | 84 | |
narshu | 0:f3bf6c7e2283 | 85 | #endif |