Cooper Liu
/
Eurobot2013_Co-Processor
working version with calibration done
Fork of Eurobot2013 by
Diff: globals.h
- Revision:
- 11:5ba926692210
- Parent:
- 10:2bd9f4e02b74
--- a/globals.h Sun Apr 07 16:30:49 2013 +0000 +++ b/globals.h Tue Apr 09 15:32:47 2013 +0000 @@ -6,23 +6,13 @@ #define ROBOT_PRIMARY -// Stepper motor defines go here, p30 is reserved for the hardware counter +// IR turret defines go here, p30 is reserved for the hardware counter #define STEPPER_PIN p21 //p21 pwmout -#define STEPPER_PERIOD 0.0001 //Stepper motor period in seconds, 50% duty cycle -#define STEPPER_DIV 3200 // number of steps per cycle = default * microstep -#define STEP_ANGLE ((float)(2*PI) / STEPPER_DIV) // step angle of stepper -#define IR_TIMEOUT_STEP 90 //about 10 degrees -#define IR_TIMEOUT (STEPPER_PERIOD*IR_TIMEOUT_STEP) +#define IR_SENSOR_PIN p17 -// IR Sensor defines go here -#define PWM_INVERT // inverts the PWM for the IR sensor pwm input -#define IR_SENSOR_PIN p17 -#define IR0_PULSEWIDTH 1000 -#define IR1_PULSEWIDTH 750 -#define IR2_PULSEWIDTH 500 -#define PULSEWIDTH_TOLERANCE 125 - - +// serial interface to the mainboard +#define MBED_MAIN_SERIAL_TX p28 +#define MBED_MAIN_SERIAL_RX p27 @@ -33,48 +23,19 @@ #ifdef ROBOT_PRIMARY // Primary defs go here -//Robot hardware parameters -const int robotCircumference = 816; //mm (DUMMY!) -//Robot movement constants -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; #else // Secondary defs go here -//Robot hardware parameters -const int robotCircumference = 816; //mm (DUMMY!) -//Robot movement constants -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; #endif //sonar constants -static const float sonarvariance = 0.005; +static const float sonarvariance = 0.01*0.01; //0.01m std //IR constants -static const float IRvariance = 0.001; - -//Arena constants -struct pos { - int x; - int y; -}; - -//beacon positions -extern pos beaconpos[]; - -//Colour -extern bool Colour; // 1 for red, 0 for blue - -//System constants -const int PREDICTPERIOD = 20; //ms +static const float IRvariance = 0.0073*0.0073; //std = 0.0073 //High speed serial port extern Serial pc;