Robot's source code

Dependencies:   mbed

Committer:
Jagang
Date:
Wed May 06 11:22:17 2015 +0000
Revision:
117:f8c147141a0c
Child:
119:c45efcd706d9
Objectif pince et depot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jagang 117:f8c147141a0c 1 #include "Obj_depot.h"
Jagang 117:f8c147141a0c 2
Jagang 117:f8c147141a0c 3 extern Motor motorL;
Jagang 117:f8c147141a0c 4 extern Motor motorR;
Jagang 117:f8c147141a0c 5
Jagang 117:f8c147141a0c 6 Obj_depot::Obj_depot(float x, float y, float theta, AX12 *ax12_pince)
Jagang 117:f8c147141a0c 7 :Objectif(x,y,theta)
Jagang 117:f8c147141a0c 8 {
Jagang 117:f8c147141a0c 9 this->ax12_pince = ax12_pince;
Jagang 117:f8c147141a0c 10 desactivate();
Jagang 117:f8c147141a0c 11 }
Jagang 117:f8c147141a0c 12
Jagang 117:f8c147141a0c 13 void Obj_depot::run()
Jagang 117:f8c147141a0c 14 {
Jagang 117:f8c147141a0c 15 ax12_pince->setGoal(PINCE_OUVERTE);
Jagang 117:f8c147141a0c 16
Jagang 117:f8c147141a0c 17 motorL.setSpeed(-0.3);
Jagang 117:f8c147141a0c 18 motorR.setSpeed(-0.3);
Jagang 117:f8c147141a0c 19 wait(0.5);
Jagang 117:f8c147141a0c 20 motorL.setSpeed(0);
Jagang 117:f8c147141a0c 21 motorR.setSpeed(0);
Jagang 117:f8c147141a0c 22
Jagang 117:f8c147141a0c 23 done = true;
Jagang 117:f8c147141a0c 24 }
Jagang 117:f8c147141a0c 25
Jagang 117:f8c147141a0c 26 int Obj_depot::isActive()
Jagang 117:f8c147141a0c 27 {
Jagang 117:f8c147141a0c 28 if(!active)
Jagang 117:f8c147141a0c 29 return false;
Jagang 117:f8c147141a0c 30
Jagang 117:f8c147141a0c 31 if(ax12_pince->getGoal() == PINCE_OUVERTE)
Jagang 117:f8c147141a0c 32 return false;
Jagang 117:f8c147141a0c 33
Jagang 117:f8c147141a0c 34 return true;
Jagang 117:f8c147141a0c 35 }