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.
Fork of Timer by
Diff: main.cpp.orig
- Revision:
- 46:5658af4e5149
- Parent:
- 45:b53ae54062c6
- Child:
- 48:03da1aead032
--- a/main.cpp.orig Wed Apr 13 12:47:47 2016 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-#include "Odometry.h"
-/** Dependencies :
- Map/Point.h
- Map/define.h
- Map/Obstacles/Obstacle.h
-
- Test en cours :
- * Un obstacle seulement
- * Radius du robot réduit à 1 (defines.cpp)
- * Nombreux
-*/
-#include "Map/Map.h"
-
-#define dt 10000
-#define ATTENTE 0
-#define GO 1
-#define STOP 2
-
-InterruptIn mybutton(USER_BUTTON);
-DigitalIn button(USER_BUTTON);
-DigitalOut led(LED1);
-Ticker ticker;
-//Serial pc(USBTX, USBRX);
-Serial pc(PA_9, PA_10);
-RoboClaw roboclaw(460800, PA_11, PA_12);
-Odometry odo(63.2, 63.3, 252, 4096, roboclaw);
-
-int i = 0;
-
-void update_main(void);
-void init(void);
-void pressed(void);
-void unpressed(void);
-
-/** Debut du programme */
-int main(void)
-{
- double angle_v = 2*PI/5;
- double distance_v = 200.0;
- std::vector<SimplePoint> path;
- Map map;
-
- init();
- //Construction des obstacles
- map.build();
- map.Astar(0, 1000, 2000, 1000);
- path = map.path;
-
- for(int i=0; i<path.size();i++) {
- odo.GotoXYT(path[i].x, path[i].y, 0);
- }
-
- //odo.GotoXYT(500, 50, 0);
- //odo.GotoXYT(200, 0, 0);
- //odo.GotoXYT(0, 0, 0);
-
- //odo.GotoThet(-PI/2);
- wait(2000);
- //odo.GotoXYT(2250,500,0);
- while(1);
-}
-
-void init(void)
-{
- pc.baud(9600);
- pc.printf("Hello from main !\n\r");
- wait_ms(500);
-
- odo.setPos(0, 0, 0);
- roboclaw.ForwardM1(ADR, 0);
- roboclaw.ForwardM2(ADR, 0);
-
- while(button);
- wait(1);
- mybutton.fall(&pressed);
- mybutton.rise(&unpressed);
- ticker.attach_us(&update_main,dt); // 100 Hz
-}
-
-void update_main(void)
-{
- odo.update_odo();
- //pc.printf("X : %3.2f\tY : %3.2f\tTheta : %3.2f\n\r", odo.getX(), odo.getY(), odo.getTheta()*180/PI);
- //if(pc.readable()) if(pc.getc()=='l') led = !led;
-}
-
-void pressed(void)
-{
- if(i==0) {
- roboclaw.ForwardM1(ADR, 0);
- roboclaw.ForwardM2(ADR, 0);
- //pc.printf("X : %3.2f\tY : %3.2f\tTheta : %3.2f\n\r", odo.getX(), odo.getY(), odo.getTheta()*180/PI);
- i++;
- }
-}
-
-void unpressed(void)
-{
- if(i==1) {
- i--;
- }
-}
\ No newline at end of file
