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
main.cpp@17:aae5361ddddf, 2019-06-04 (annotated)
- Committer:
- theolp
- Date:
- Tue Jun 04 17:25:49 2019 +0000
- Revision:
- 17:aae5361ddddf
- Parent:
- 16:05665faaa489
- Child:
- 19:dad67302af25
Odometrie position, dbug position, angles compris entre -180 et 180, fonction updateCAN. Bonne version.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Wael_H | 2:8971078b1ccf | 1 | #include "mbed.h" |
Wael_H | 5:34048faec367 | 2 | #include "CAN_asser.h" |
Wael_H | 10:efa507ba2b35 | 3 | #include "Robot.h" |
Wael_H | 10:efa507ba2b35 | 4 | |
Wael_H | 16:05665faaa489 | 5 | void automate_testDeplacement(Robot&); |
Wael_H | 8:94ecfe411d02 | 6 | |
Wael_H | 2:8971078b1ccf | 7 | int main(void) |
Wael_H | 2:8971078b1ccf | 8 | { |
Wael_H | 10:efa507ba2b35 | 9 | Robot robot; |
Wael_H | 7:753e901d441b | 10 | |
theolp | 17:aae5361ddddf | 11 | SetOdometrie(ODOMETRIE_POSITION, 2000, 0, 0); // Erreur echange de X et Y... |
theolp | 17:aae5361ddddf | 12 | |
theolp | 17:aae5361ddddf | 13 | robot.setSpeed(40,400); |
theolp | 17:aae5361ddddf | 14 | |
theolp | 17:aae5361ddddf | 15 | Timer timer_dbug; |
theolp | 17:aae5361ddddf | 16 | timer_dbug.start(); |
Wael_H | 15:3d4543a6c100 | 17 | |
Wael_H | 15:3d4543a6c100 | 18 | while(1) |
theolp | 17:aae5361ddddf | 19 | { |
Wael_H | 16:05665faaa489 | 20 | automate_testDeplacement(robot); |
theolp | 17:aae5361ddddf | 21 | |
theolp | 17:aae5361ddddf | 22 | if(timer_dbug.read() > 0.5f) |
theolp | 17:aae5361ddddf | 23 | { |
theolp | 17:aae5361ddddf | 24 | dbug.printf("PosX : %d --- PosY : %d\n\r", robot.pos(Robot::X), robot.pos(Robot::Y)); |
theolp | 17:aae5361ddddf | 25 | dbug.printf("Angle : %d degres\n\r", robot.pos(Robot::THETA) / 10 ); |
theolp | 17:aae5361ddddf | 26 | sauter_lignes(25); |
theolp | 17:aae5361ddddf | 27 | timer_dbug.stop(); |
theolp | 17:aae5361ddddf | 28 | timer_dbug.reset(); |
theolp | 17:aae5361ddddf | 29 | timer_dbug.start(); |
theolp | 17:aae5361ddddf | 30 | } |
theolp | 17:aae5361ddddf | 31 | } |
Wael_H | 15:3d4543a6c100 | 32 | } |
Wael_H | 15:3d4543a6c100 | 33 | |
Wael_H | 16:05665faaa489 | 34 | void automate_testDeplacement(Robot& robot) |
Wael_H | 15:3d4543a6c100 | 35 | { |
theolp | 17:aae5361ddddf | 36 | typedef enum{AVANCE,TOURNE} type_etat; |
Wael_H | 16:05665faaa489 | 37 | static type_etat etat = AVANCE; |
Wael_H | 7:753e901d441b | 38 | |
Wael_H | 7:753e901d441b | 39 | switch(etat) |
Wael_H | 9:2113adf37c66 | 40 | { |
Wael_H | 16:05665faaa489 | 41 | case AVANCE: |
theolp | 17:aae5361ddddf | 42 | if(robot.avance(500)) |
Wael_H | 16:05665faaa489 | 43 | etat = TOURNE; |
Wael_H | 13:9c62e263f245 | 44 | break; |
Wael_H | 13:9c62e263f245 | 45 | |
Wael_H | 16:05665faaa489 | 46 | case TOURNE: |
theolp | 17:aae5361ddddf | 47 | if(robot.tourne(900)) |
theolp | 17:aae5361ddddf | 48 | etat = AVANCE; |
Wael_H | 13:9c62e263f245 | 49 | break; |
Wael_H | 13:9c62e263f245 | 50 | } |
Wael_H | 13:9c62e263f245 | 51 | } |
Wael_H | 16:05665faaa489 | 52 |