Robot's source code

Dependencies:   mbed

Map/Objectifs/Obj_depot.cpp

Committer:
Jagang
Date:
2015-05-06
Revision:
119:c45efcd706d9
Parent:
117:f8c147141a0c

File content as of revision 119:c45efcd706d9:

#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);
    wait(1.5);
    ax12_pince->setMaxTorque(0);
    
    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;
}