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: RoboClaw mbed StepperMotor
Fork of RoboClaw by
Diff: Map/map.cpp
- Revision:
- 57:86f491f5b25d
- Parent:
- 56:4fd9636dfb36
- Child:
- 60:8d2320a54a32
--- a/Map/map.cpp Wed May 04 19:43:53 2016 +0200
+++ b/Map/map.cpp Wed May 04 21:04:50 2016 +0200
@@ -1,13 +1,17 @@
#include "map.h"
+/* Dernier Changement : Romain 20h30 */
+
map::map (Odometry* nodo) : Codo(nodo) {
}
void map::Build (int couleur, int formation) {
- max_x_table = 2800;
- max_y_table = 1800;
- min_x_table = 0;
- min_y_table = 0;
+ if (couleur == VERT) {
+ max_x_table = 2800;
+ max_y_table = 1800;
+ min_x_table = 0;
+ min_y_table = 0;
+ }
addObs(obsCarr (800, 100, 100, 15));
addObs(obsCarr (2200, 100, 100, 15));
@@ -15,7 +19,7 @@
addObs(obsCarr (1500, 750, 1100, 15));
addObs(obsCarr (1500, 1050, 20, 300));
- if (formation == MAP_RIGHTSIDE) {
+ if (formation == 1) {
addObs(obsCarr (0, 2000, 250, 150)); // Coté haut droite
addObs(obsCarr (200, 2000, 200, 50));
@@ -206,4 +210,26 @@
logger.printf("Chemin pas trouve ...\n\r");
}
endedParc = false;
+}
+
+void map::Execute(float XObjectif, float YObjectif) {
+ // logger.printf("Findway %f-%f -> %f-%f\n\r", Codo->getX(), Codo->getY(), XObjectif, YObjectif);
+ Objectif o;
+ FindWay (Codo->getX(), Codo->getY(), o.getX(), o.getY());
+
+ if (endedParc) {
+ //logger.printf("\n\r");
+ for (int i = 0; i < path.size (); i++) {
+ // logger.printf("Goto %d/%d [%f, %f]... \n\r", i, path.size()-1, path[i].getX(), path[i].getY());
+ //the = (float) atan2((double) (p[i].gety() - odo.getY()), (double) (p[i].getx() - odo.getX()));
+ Codo->GotoXY((double)path[i].getX(), (double)path[i].getY());
+ // logger.printf("Goto Fini\n\r");
+ }
+
+ //logger.printf("Chemin fini !\n\r");
+ }
+ else {
+ logger.printf("Chemin pas trouve ...\n\r");
+ }
+ endedParc = false;
}
\ No newline at end of file
