Robot's source code
Dependencies: mbed
Diff: main.cpp
- Revision:
- 47:4909e97570f6
- Parent:
- 45:b7617d7cedce
- Child:
- 48:cb3ebbc27db3
--- a/main.cpp Tue Mar 24 09:17:11 2015 +0000 +++ b/main.cpp Thu Mar 26 18:04:23 2015 +0000 @@ -12,8 +12,9 @@ #include "Motor.h" /*----------------------------------------------------------------------------------------------*/ /*Serial*/ -Serial logger(OUT_TX, OUT_RX); // tx, rx -//Serial logger(USBTX,USBRX); +//Serial logger(OUT_TX, OUT_RX); // tx, rx +Serial logger(USBTX,USBRX); +logger.baud(115200); /*----------------------------------------------------------------------------------------------*/ /* --- Initialisation de la liste des obstable --- */ @@ -88,15 +89,15 @@ wait(1); motorR.setSpeed(0.0); }*/ - bool testOdo = false; + bool testOdo = true; Asserv<float> instanceAsserv(&odometry); /*----------------------------------------------------------------------------------------------*/ - instanceAsserv.setGoal( (float)150,(float)0, (float)0); + instanceAsserv.setGoal( (float)200,(float)0, (float)0); - while(1) + while(!testOdo) { //Asservissement : @@ -104,9 +105,9 @@ instanceAsserv.update((float)t.read()); Mat<float> X( instanceAsserv.getX() ); - float phi_r = instanceAsserv.getPhiR(); - float phi_l = instanceAsserv.getPhiL(); - float phi_max = instanceAsserv.getPhiMax(); + float phi_r = (float)instanceAsserv.getPhiR(); + float phi_l = (float)instanceAsserv.getPhiL(); + float phi_max = (float)instanceAsserv.getPhiMax(); //logger.printf(" x : %f ;\t y : %f ;\t theta : %f ;\t VD = %f ;\t W = %f \n\r",X.get(1,1),X.get(2,1),X.get(3,1), X.get(4,1), X.get(5,1) ); //logger.printf(" x : %f ;\t y : %f ;\t theta : %f ",X.get(1,1),X.get(2,1),X.get(3,1) ); @@ -134,11 +135,8 @@ while(1) { - //setPWM(&pw1,0.0); - //setPWM(&pw2,0.0); - pw1.write(0.0); - pw2.write(0.0); - led = !led; + motorR.setSpeed(1.0); + motorL.setSpeed(1.0); wait(1); } }