Robot's source code

Dependencies:   mbed

Committer:
Jagang
Date:
Wed May 06 15:17:16 2015 +0000
Revision:
119:c45efcd706d9
Parent:
117:f8c147141a0c
Modif asserv B; Impl?mentation de l'IA et des objectifs (Ramasser PC et d?poser)

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 119:c45efcd706d9 16 wait(1.5);
Jagang 119:c45efcd706d9 17 ax12_pince->setMaxTorque(0);
Jagang 117:f8c147141a0c 18
Jagang 117:f8c147141a0c 19 motorL.setSpeed(-0.3);
Jagang 117:f8c147141a0c 20 motorR.setSpeed(-0.3);
Jagang 117:f8c147141a0c 21 wait(0.5);
Jagang 117:f8c147141a0c 22 motorL.setSpeed(0);
Jagang 117:f8c147141a0c 23 motorR.setSpeed(0);
Jagang 117:f8c147141a0c 24
Jagang 117:f8c147141a0c 25 done = true;
Jagang 117:f8c147141a0c 26 }
Jagang 117:f8c147141a0c 27
Jagang 117:f8c147141a0c 28 int Obj_depot::isActive()
Jagang 117:f8c147141a0c 29 {
Jagang 117:f8c147141a0c 30 if(!active)
Jagang 117:f8c147141a0c 31 return false;
Jagang 117:f8c147141a0c 32
Jagang 117:f8c147141a0c 33 if(ax12_pince->getGoal() == PINCE_OUVERTE)
Jagang 117:f8c147141a0c 34 return false;
Jagang 117:f8c147141a0c 35
Jagang 117:f8c147141a0c 36 return true;
Jagang 117:f8c147141a0c 37 }