Cooper Liu
/
Eurobot2013_Co-Processor
working version with calibration done
Fork of Eurobot2013 by
Diff: globals.h
- Revision:
- 10:2bd9f4e02b74
- Parent:
- 7:88753d0ad4ca
- Child:
- 11:5ba926692210
--- a/globals.h Wed Nov 14 17:15:53 2012 +0000 +++ b/globals.h Sun Apr 07 16:30:49 2013 +0000 @@ -1,12 +1,30 @@ #ifndef GLOBALS_H #define GLOBALS_H +#include "mbed.h" +#define PI 3.14159265 #define ROBOT_PRIMARY +// Stepper motor 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) -#include "mbed.h" -#define PI 3.14159265 +// 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 + + + + //enables ui //#define UION @@ -15,10 +33,6 @@ #ifdef ROBOT_PRIMARY // Primary defs go here -#else -// Secondary defs go here -#endif - //Robot hardware parameters const int robotCircumference = 816; //mm (DUMMY!) @@ -27,6 +41,19 @@ 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;