Romain Ame
/
Timer71pt
Fork de Timer après le match à 61 points
Fork of Timer by
main.cpp@0:ad9600df4a70, 2015-11-16 (annotated)
- Committer:
- sype
- Date:
- Mon Nov 16 11:32:44 2015 +0000
- Revision:
- 0:ad9600df4a70
- Child:
- 2:abdf8c6823a1
oklm;
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:ad9600df4a70 | 5 | Ticker ticker; |
sype | 0:ad9600df4a70 | 6 | //Timer t; |
sype | 0:ad9600df4a70 | 7 | |
sype | 0:ad9600df4a70 | 8 | Odometry odo(47.4, 47.2, 231.0); |
sype | 0:ad9600df4a70 | 9 | |
sype | 0:ad9600df4a70 | 10 | //Serial pc(PA_9, PA_10); |
sype | 0:ad9600df4a70 | 11 | //Serial pc(USBTX, USBRX); |
sype | 0:ad9600df4a70 | 12 | |
sype | 0:ad9600df4a70 | 13 | void update_main(void); |
sype | 0:ad9600df4a70 | 14 | |
sype | 0:ad9600df4a70 | 15 | int main(void) |
sype | 0:ad9600df4a70 | 16 | { |
sype | 0:ad9600df4a70 | 17 | odo.setPos(0, 0, 0); |
sype | 0:ad9600df4a70 | 18 | //pc.baud(115200); |
sype | 0:ad9600df4a70 | 19 | //pc.printf("Hello world !\n\r"); |
sype | 0:ad9600df4a70 | 20 | ticker.attach_us(&update_main,dt); // 100 Hz |
sype | 0:ad9600df4a70 | 21 | wait_ms(1000); |
sype | 0:ad9600df4a70 | 22 | |
sype | 0:ad9600df4a70 | 23 | while(1) |
sype | 0:ad9600df4a70 | 24 | { |
sype | 0:ad9600df4a70 | 25 | //pc.printf("Enc1 : %6.2f\tSpeed1 :%6.2f\tEnc2 : %6.2f\tSpeed2 : %6.2f\n\r",enc1,speed1,enc2,speed2); |
sype | 0:ad9600df4a70 | 26 | //pc.printf("Theta : %5d\n\r", _roboclaw.ReadEncM1(ADR)); |
sype | 0:ad9600df4a70 | 27 | wait_ms(10); |
sype | 0:ad9600df4a70 | 28 | } |
sype | 0:ad9600df4a70 | 29 | } |
sype | 0:ad9600df4a70 | 30 | |
sype | 0:ad9600df4a70 | 31 | void update_main(void) |
sype | 0:ad9600df4a70 | 32 | { |
sype | 0:ad9600df4a70 | 33 | odo.update_odo(); |
sype | 0:ad9600df4a70 | 34 | odo.GotoXYT(100,100,0); |
sype | 0:ad9600df4a70 | 35 | //pc.printf("Theta : %3.3f\n\r", odo.getTheta()*180/PI); |
sype | 0:ad9600df4a70 | 36 | } |