Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Eurobot_2012_Secondary by
globals.h
00001 #ifndef GLOBALS_H 00002 #define GLOBALS_H 00003 00004 #include "mbed.h" 00005 #define PI 3.14159265 00006 00007 00008 #define ROBOT_SECONDARY 00009 00010 //enables ui 00011 //#define UION 00012 00013 #ifdef ROBOT_SECONDARY 00014 //Secondary Robot constants in mm 00015 const int robot_width = 260; 00016 const int encoderRevCount = 360; 00017 const int wheelmm = 229; 00018 const int robotCircumference = 816; 00019 00020 00021 #else 00022 #define ROBOT_PRIMARY 00023 // invert echo polarity for primary 00024 #define SONAR_ECHO_INV 00025 // Primary Robot constants 00026 const int robot_width = 390; 00027 const int encoderRevCount = 1856; 00028 const int wheelmm = 308; 00029 const int robotCircumference = 1150; 00030 #endif 00031 00032 00033 00034 //Robot movement constants 00035 const float fwdvarperunit = 0.01; //1 std dev = 7% //NEEDS TO BE MEASURED AGAIN! 00036 const float varperang = 0.01; //around 1 degree stddev per 180 turn 00037 const float xyvarpertime = 0.0005; //(very poorly) accounts for hitting things 00038 const float angvarpertime = 0.001; 00039 00040 //sonar constants 00041 static const float sonarvariance = 0.005; 00042 00043 //IR constants 00044 static const float IRvariance = 0.001; 00045 00046 //Arena constants 00047 struct pos { 00048 int x; 00049 int y; 00050 }; 00051 00052 //beacon positions 00053 extern pos beaconpos[]; 00054 00055 //Colour 00056 extern bool Colour; // 1 for red, 0 for blue 00057 00058 //System constants 00059 const int PREDICTPERIOD = 20; //ms 00060 00061 //High speed serial port 00062 extern Serial pc; 00063 00064 //I2C mutex 00065 //extern Mutex i2c_rlock; 00066 //extern Mutex i2c_wlock; 00067 00068 00069 // IR angle calc 00070 #define RELI_BOUND_LOW 4 00071 #define RELI_BOUND_HIGH 25 00072 00073 // Movement target tolerances 00074 #define POSITION_TOR 40 // in mm 00075 #define ANGLE_TOR 0.06 // in rad 00076 00077 // motion control 00078 static int MOVE_SPEED = 45; 00079 #define MAX_STEP_RATIO 0.10 //maximum change in the speed 00080 //#define TRACK_RATE 10 // +- rate for each wheel when tracking 00081 00082 #ifdef ROBOT_PRIMARY 00083 #define FWD_MOVE_P 18 00084 #define SPIN_MOVE_P 5.8 00085 #else 00086 #define FWD_MOVE_P 12.4 //3.2 00087 #define SPIN_MOVE_P 4 00088 #endif 00089 00090 // Task suspend periods 00091 #define IR_TURRET_PERIOD 200 00092 #define MOTION_UPDATE_PERIOD 20 00093 00094 #endif
Generated on Tue Jul 12 2022 21:02:12 by
1.7.2
