sasasa

Dependencies:   HMC6352 PID eeprom mbed

Fork of ver1_2_2_1 by ryo seki

main.h

Committer:
yusuke_robocup
Date:
2013-04-05
Revision:
2:09fabba6c00d
Parent:
1:89408fff7cc9
Child:
3:b4fb2b5365a7

File content as of revision 2:09fabba6c00d:



#define RATE    0.052
#define Long    1.0
#define ENTER   0
#define EXIT    1
#define MOT_NUM 4
#define MOTDRIVER_WAIT  300 //ms
#define BAUD_RATE       115200
#define ON      1
#define OFF     0

#define MOT1    1.0             //60  3.0 0.0 0.5 1.0
#define MOT2    1.0             //120 0.0 3.0 1.0 0.0
#define MOT3    1.0            //240 0.6 0.0 0.0 3.0
#define MOT4    1.0             //300 0.0 0.8 3.0 0.0

#define OUT_LIMIT   30.0
#define MAX_POW     100
#define MIN_POW     -100

#define SHINPUKU 40

#define FULL 0




DigitalOut led1(LED1); 
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
HMC6352 compass(p9, p10);
Serial driver(p28, p27); // tx, rx 
Serial pc(USBTX, USBRX); // tx, rx 
DigitalIn StartButton(p21);
DigitalIn CalibEnterButton(p22);
DigitalIn CalibExitButton(p23);
DigitalIn EEPROMButton(p24);
PID pid(0.35, 0.0, 0.012, RATE);      //30.0 0.35 1.0 0.012 30.0    0.42 1.0 0.013 
Ticker pidUpdata;
Ticker IR;
Ticker ultrasonic;
Timer timer1;
Timer timer2;
Timer timer_ir;     /* 赤外線用タイマー */


int speed[MOT_NUM] = {0};
 
static float lastData = 0.0;
static float inputPID = 180.0;
static float standard;
static float compassPID = 0.0;

extern string StringFIN;

extern int direction;
extern int Distance;
extern int IR_found;
extern double ball_sankaku[16][2];
extern double turn_sankaku[16][2];
extern double ultrasonicVal[3];
float now_compass =20.0;
float past_compass;
int turn_flag = 0;

extern void Ultrasonic(void);
extern void IR_Position(void);
extern void PidUpdata(void);
extern void array(int,int,int,int);

enum{
    NONE,
    SNAKE,
    ATTACK,
    SEARCH
};