DERPS

Dependencies:   BMP280 BNO055_fusion PowerControl mbed

Fork of STRAIGHT_DRIVE_NO_SEP by Antoine Laurens

LOCOMOTION.h

Committer:
12104404
Date:
2016-04-03
Revision:
23:455f7da3dd7a
Parent:
19:2dd81b864e14
Child:
24:fb1f083ebd62

File content as of revision 23:455f7da3dd7a:

#ifndef LOCOMOTION_H
#define LOCOMOTION_H

#include "mbed.h"
#include "LOCALIZE.h"

#define SPEED_TURN_MIN  0.20
#define SPEED_TURN_MAX  0.65

enum {
    ANGLE_TURN  = 0,
    ANGLE_BIAS  = 1,
};

class LOCOMOTION
{
public:
    LOCOMOTION(PinName en, PinName motor1F, PinName motor1B,PinName motor2F, PinName motor2B, PinName forward1, PinName forward2);
    DigitalOut _en;
    PwmOut _m1f;
    PwmOut _m1b;
    PwmOut _m2f;
    PwmOut _m2b;
    DigitalOut _m1dir;
    DigitalOut _m2dir;
    void eStop(void);
    bool setXPos(int target, int current, int error, int angle);
    bool setYPos(int target, int current, int error, int angle);
    bool setAngle(int target, int current, int error, int mode);

protected:
    float s;
    void stopMotors(void);
    int wrap(int num);
    
};
#endif