ARES / Mbed 2 deprecated Robot 2016

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Obj_depot.cpp Source File

Obj_depot.cpp

00001 #include "Obj_depot.h"
00002 
00003 extern Motor motorL;
00004 extern Motor motorR;
00005 extern bool interruption;
00006 
00007 Obj_depot::Obj_depot(float x, float y, float theta, AX12 *ax12_pince)
00008 :Objectif(x,y,theta)
00009 {
00010     this->ax12_pince = ax12_pince;
00011     desactivate();
00012 }
00013 
00014 void Obj_depot::run()
00015 {
00016     ax12_pince->setMaxTorque(MAX_TORQUE);
00017     wait(0.1);
00018     ax12_pince->setGoal(PINCE_OUVERTE);
00019     wait(1);
00020     
00021     if(!interruption)
00022     {
00023         motorL.setSpeed(-0.3);
00024         motorR.setSpeed(-0.3);
00025         wait(0.5);
00026         motorL.setSpeed(0);
00027         motorR.setSpeed(0);
00028     }
00029     
00030     done = true;
00031 }
00032 
00033 int Obj_depot::isActive()
00034 {
00035     if(!active)
00036         return false;
00037     
00038     if(ax12_pince->getGoal() == PINCE_OUVERTE)
00039         return false;
00040     
00041     return true;
00042 }