working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

globals.h

Committer:
xiaxia686
Date:
2013-04-07
Revision:
10:2bd9f4e02b74
Parent:
7:88753d0ad4ca
Child:
11:5ba926692210

File content as of revision 10:2bd9f4e02b74:

#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)

// 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



#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;

//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

//High speed serial port
extern Serial pc;


#endif