version2
Dependencies: BNO055_fusion mbed
Fork of DEMO2 by
LOCOMOTION.h
- Committer:
- alaurens
- Date:
- 2016-03-29
- Revision:
- 20:1da786e205eb
- Parent:
- 19:5832e34b7533
File content as of revision 20:1da786e205eb:
#ifndef LOCOMOTION_H #define LOCOMOTION_H #include "mbed.h" #include "LOCALIZE.h" #define SPEED_TURN_MIN 0.20 #define SPEED_TURN_MAX 0.65 #define X_INCREASE 1 #define X_DECREASE 2 #define X_BACKWARDS 3 #define BACKOFF 20 #define X_NEAR_GOAL 20 #define X_FAR_GOAL 80 #define Y_INCREMENT 20 enum { ANGLE_TURN = 0, ANGLE_BIAS = 1, }; class LOCOMOTION { public: LOCOMOTION(PinName motor1F, PinName motor1B,PinName motor2F, PinName motor2B, PinName forward1, PinName forward2); PwmOut _m1f; PwmOut _m1b; PwmOut _m2f; PwmOut _m2b; DigitalOut _m1dir; DigitalOut _m2dir; void setXstate(int *xCurrState, int *xTarget,bool xGood,bool angleGood,int *angleGoal); void setAngleTol(int *angleTol,bool yGood, bool xGood); void setYgoal(bool xGood,bool angleGood,bool yGood,int *yTarget); void adjustY(int XcurrState,int Ytarget); 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); void check_xya(bool *xGood,bool *yGood,bool *angleGood, int xGoal,int angleGoal,int yGoal,LOCALIZE_xya xya,int xErr, int yErr,int angleErr); int wrap(int num); protected: float s; }; #endif