
Robot's source code
Dependencies: mbed
Revision 115:c88c058ced64, committed 2015-05-06
- Comitter:
- Jagang
- Date:
- Wed May 06 06:51:49 2015 +0000
- Parent:
- 113:a30ae31795e8
- Parent:
- 114:be06d518b4a7
- Child:
- 116:73d7d87e0299
- Child:
- 117:f8c147141a0c
- Commit message:
- Merge
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Map/Objectifs/Obj_pince.cpp Wed May 06 06:51:49 2015 +0000 @@ -0,0 +1,1 @@ +#include "Obj_pince.h" \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Map/Objectifs/Obj_pince.h Wed May 06 06:51:49 2015 +0000 @@ -0,0 +1,27 @@ +#ifndef OBJ_PINCE_H +#define OBJ_PINCE_H + + +#include "defines.h" + +#include "AX12.h" +#include "Objectif.h" + +class Obj_clap: public Objectif +{ +public: + #ifdef PLAN_A + Obj_clap(float x, float y, float theta, Asserv<float> *asserv, AX12 *ax12_brasG, AX12 *ax12_brasD); + #else + Obj_clap(float x, float y, float theta, aserv_planB *asserv, AX12 *ax12_brasG, AX12 *ax12_brasD); + #endif + virtual void run(); + virtual int isActive(); +private: + AX12 *ax12_brasG; + AX12 *ax12_brasD; +}; + + + +#endif
--- a/main.cpp Tue May 05 17:00:55 2015 +0000 +++ b/main.cpp Wed May 06 06:51:49 2015 +0000 @@ -218,7 +218,7 @@ #define IA #ifdef IA - logger.printf("Pathfinding ... "); + /*logger.printf("Pathfinding ... "); Timer t; t.start(); int i = terrain.AStar(1000,300,1750,450,10); @@ -227,18 +227,18 @@ logger.printf("Return : %d in %.3fms\r\n",i,t.read()*1000); - for(i=0;i<terrain.path.size();i++) + for(i=0;i<terrain.path.size()-1;i++) { logger.printf("%d\t%.3f\t%.3f\r\n",i,terrain.path[i].x,terrain.path[i].y); asserv.setGoal(terrain.path[i].x,terrain.path[i].y); while(!asserv.isArrived())wait(0.1); } + asserv.setGoal(terrain.path[i].x,terrain.path[i].y); + while(!asserv.isArrived())wait(0.1); logger.printf("Finit !! \r\n"); - while(1); - - #endif + while(1);*/ while(continuer) { @@ -261,17 +261,27 @@ if(newObj) { + /* Déplacement vers le nouvel objectif */ + for(i=0;i<terrain.path.size()-1;i++) + { + logger.printf("%d\t%.3f\t%.3f\r\n",i,terrain.path[i].x,terrain.path[i].y); + asserv.setGoal(terrain.path[i].x,terrain.path[i].y); + while(!asserv.isArrived())wait(0.1); + } + asserv.setGoal(objectifs[objAct]->getX(),objectifs[objAct]->getY(),objectifs[objAct]->getTheta()); + while(!asserv.isArrived())wait(0.1); - + objectifs[objAct]->run(); } else { logger.printf("Nothind to be done ... :( \r\n"); wait(1); } - } + #endif + #ifdef PLAN_A asserv.setGoal(300.0f,200.0f,0.0f); logger.printf("GOAL SET... RUNNING!\r\n");