Test du path finding

Dependencies:   RoboClaw mbed

Fork of TestMyPathFind by Romain Ame

Committer:
sype
Date:
Tue Nov 24 21:42:10 2015 +0000
Revision:
3:62e9d715de65
Parent:
2:abdf8c6823a1
Child:
9:e39b218ab20d
GotoThet quasi fini, essayez d'y jeter un coup d'oeil pour me donner vos impressions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sype 0:ad9600df4a70 1 #include "Odometry.h"
sype 0:ad9600df4a70 2
sype 0:ad9600df4a70 3 #define dt 10000
sype 0:ad9600df4a70 4
sype 2:abdf8c6823a1 5 InterruptIn button(USER_BUTTON);
sype 2:abdf8c6823a1 6 DigitalOut led(LED1);
sype 0:ad9600df4a70 7 Ticker ticker;
sype 2:abdf8c6823a1 8 Serial pc(USBTX, USBRX);
sype 0:ad9600df4a70 9 //Serial pc(PA_9, PA_10);
sype 2:abdf8c6823a1 10 RoboClaw roboclaw(115200, PA_11, PA_12);
sype 2:abdf8c6823a1 11 Odometry odo(47.4, 47.1, 242.0, roboclaw);
sype 0:ad9600df4a70 12
sype 0:ad9600df4a70 13 void update_main(void);
sype 2:abdf8c6823a1 14 void init(void);
sype 0:ad9600df4a70 15
sype 0:ad9600df4a70 16 int main(void)
sype 2:abdf8c6823a1 17 {
sype 2:abdf8c6823a1 18 init();
sype 3:62e9d715de65 19 odo.GotoXYT(2250,500,0);
sype 2:abdf8c6823a1 20 while(1);
sype 2:abdf8c6823a1 21 }
sype 2:abdf8c6823a1 22
sype 2:abdf8c6823a1 23 void init(void)
sype 0:ad9600df4a70 24 {
sype 2:abdf8c6823a1 25 pc.baud(115200);
sype 2:abdf8c6823a1 26 pc.printf("Hello from main !\n\r");
sype 2:abdf8c6823a1 27 roboclaw.ForwardM1(ADR, 0);
sype 2:abdf8c6823a1 28 roboclaw.ForwardM2(ADR, 0);
sype 2:abdf8c6823a1 29 wait_ms(500);
sype 2:abdf8c6823a1 30 roboclaw.ResetEnc(ADR);
sype 3:62e9d715de65 31 odo.setPos(1500, 1000, 2*PI/3);
sype 0:ad9600df4a70 32 ticker.attach_us(&update_main,dt); // 100 Hz
sype 0:ad9600df4a70 33 }
sype 0:ad9600df4a70 34
sype 0:ad9600df4a70 35 void update_main(void)
sype 0:ad9600df4a70 36 {
sype 0:ad9600df4a70 37 odo.update_odo();
sype 2:abdf8c6823a1 38 //pc.printf("EncM1 : %6d\tEncM2 : %6d\tTheta : %3.2f\n\r", roboclaw.ReadEncM1(ADR), roboclaw.ReadEncM2(ADR), odo.getTheta()*180/PI);
sype 2:abdf8c6823a1 39 //if(pc.readable()) if(pc.getc()=='l') led = !led;
sype 0:ad9600df4a70 40 }