Eurobot2012_Primary

Dependencies:   mbed Eurobot_2012_Primary

Committer:
narshu
Date:
Thu Apr 26 21:02:12 2012 +0000
Revision:
2:cffa347bb943
Parent:
1:bbabbd997d21
Child:
5:7ac07bf30707
not working

Who changed what in which revision?

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