Robot's source code
Dependencies: mbed
Diff: Map/Objectifs/Obj_depot.cpp
- Revision:
- 117:f8c147141a0c
- Child:
- 119:c45efcd706d9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Map/Objectifs/Obj_depot.cpp Wed May 06 11:22:17 2015 +0000 @@ -0,0 +1,35 @@ +#include "Obj_depot.h" + +extern Motor motorL; +extern Motor motorR; + +Obj_depot::Obj_depot(float x, float y, float theta, AX12 *ax12_pince) +:Objectif(x,y,theta) +{ + this->ax12_pince = ax12_pince; + desactivate(); +} + +void Obj_depot::run() +{ + ax12_pince->setGoal(PINCE_OUVERTE); + + motorL.setSpeed(-0.3); + motorR.setSpeed(-0.3); + wait(0.5); + motorL.setSpeed(0); + motorR.setSpeed(0); + + done = true; +} + +int Obj_depot::isActive() +{ + if(!active) + return false; + + if(ax12_pince->getGoal() == PINCE_OUVERTE) + return false; + + return true; +}