Sorfware for Lexy ( Hexapode )

Dependencies:   mbed BLE_API X_NUCLEO_IDB0XA1 MODSERIAL

SERVO/Motors.cpp

Committer:
Essenceia
Date:
2016-08-11
Revision:
1:8bab9152933e
Parent:
0:edce82659847

File content as of revision 1:8bab9152933e:

#include "Motors.h"
#include "LOGGER.h"

Motors::Motors(char t, bool mid)
{

    if(t<3) {
        type=t;
        middel=mid;
        //on rempli les angles sellon le type
        switch(type) {
            case COAX:
                if(middel) {
                    libre[0]=COAX_D1_MIL;
                    libre[1]=COAX_D2_MIL;
                } else {
                    libre[0]=COAX_D1;
                    libre[1]=COAX_D2;
                }
                break;
            case FEMUR:
                libre[0]=FEMUR_D1;
                libre[1]=FEMUR_D2;
                break;
            case TIBIA:
                libre[0]=TIBIA_D1;
                libre[1]=TIBIA_D2;
                break;
        }
    } else Logger::Instance()->log("Erreur, le type donner est invalide");
}
Motors::~Motors()
{
};

char Motors::get_type()
{
    return type;
}

bool Motors::is_valide_pos(int pos, bool D)
{
    int i=1;
    if(D) i=0;
    if(pos>libre[i])return true;
    else return false;

}