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.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 17:aae5361ddddf
- Parent:
- 16:05665faaa489
- Child:
- 19:dad67302af25
--- a/main.cpp Tue Jun 04 08:49:01 2019 +0000 +++ b/main.cpp Tue Jun 04 17:25:49 2019 +0000 @@ -8,35 +8,44 @@ { Robot robot; - robot.setSpeed(50,300); + SetOdometrie(ODOMETRIE_POSITION, 2000, 0, 0); // Erreur echange de X et Y... + + robot.setSpeed(40,400); + + Timer timer_dbug; + timer_dbug.start(); while(1) + { automate_testDeplacement(robot); + + if(timer_dbug.read() > 0.5f) + { + dbug.printf("PosX : %d --- PosY : %d\n\r", robot.pos(Robot::X), robot.pos(Robot::Y)); + dbug.printf("Angle : %d degres\n\r", robot.pos(Robot::THETA) / 10 ); + sauter_lignes(25); + timer_dbug.stop(); + timer_dbug.reset(); + timer_dbug.start(); + } + } } void automate_testDeplacement(Robot& robot) { - typedef enum{AVANCE,TOURNE,GOTO,SARRETE} type_etat; + typedef enum{AVANCE,TOURNE} type_etat; static type_etat etat = AVANCE; switch(etat) { case AVANCE: - if(robot.avance(2000)) + if(robot.avance(500)) etat = TOURNE; break; case TOURNE: - if(robot.tourne(450)) - etat = GOTO; - break; - - case GOTO: - BendRadius(30,90,0,0); - etat = SARRETE; - break; - - case SARRETE: + if(robot.tourne(900)) + etat = AVANCE; break; } }