uhbduhbv
Dependencies: BNO055_fusion mbed
Fork of DEMO3 by
LOCOMOTION.h@19:5832e34b7533, 2016-03-29 (annotated)
- Committer:
- alaurens
- Date:
- Tue Mar 29 21:58:26 2016 +0000
- Revision:
- 19:5832e34b7533
- Parent:
- 18:f9012e93edb8
everything is beautiful
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
12104404 | 6:0602a9e8118b | 1 | #ifndef LOCOMOTION_H |
12104404 | 6:0602a9e8118b | 2 | #define LOCOMOTION_H |
12104404 | 6:0602a9e8118b | 3 | |
12104404 | 6:0602a9e8118b | 4 | #include "mbed.h" |
12104404 | 17:2f89826b5679 | 5 | #include "LOCALIZE.h" |
12104404 | 6:0602a9e8118b | 6 | |
12104404 | 16:d6f15a13c3aa | 7 | #define SPEED_TURN_MIN 0.20 |
12104404 | 16:d6f15a13c3aa | 8 | #define SPEED_TURN_MAX 0.65 |
alaurens | 19:5832e34b7533 | 9 | #define x_increase 1 |
alaurens | 19:5832e34b7533 | 10 | #define x_decrease 2 |
alaurens | 19:5832e34b7533 | 11 | #define x_backwards 3 |
alaurens | 19:5832e34b7533 | 12 | #define backoff 20 |
alaurens | 19:5832e34b7533 | 13 | #define xNearGoal 20 |
alaurens | 19:5832e34b7533 | 14 | #define xFarGoal 80 |
alaurens | 19:5832e34b7533 | 15 | #define yIncrement 20 |
alaurens | 19:5832e34b7533 | 16 | |
12104404 | 15:7729da55873a | 17 | |
12104404 | 15:7729da55873a | 18 | enum { |
12104404 | 15:7729da55873a | 19 | ANGLE_TURN = 0, |
12104404 | 15:7729da55873a | 20 | ANGLE_BIAS = 1, |
12104404 | 15:7729da55873a | 21 | }; |
12104404 | 6:0602a9e8118b | 22 | |
12104404 | 6:0602a9e8118b | 23 | class LOCOMOTION |
12104404 | 6:0602a9e8118b | 24 | { |
12104404 | 6:0602a9e8118b | 25 | public: |
12104404 | 15:7729da55873a | 26 | LOCOMOTION(PinName motor1F, PinName motor1B,PinName motor2F, PinName motor2B, PinName forward1, PinName forward2); |
12104404 | 15:7729da55873a | 27 | PwmOut _m1f; |
12104404 | 15:7729da55873a | 28 | PwmOut _m1b; |
12104404 | 15:7729da55873a | 29 | PwmOut _m2f; |
12104404 | 15:7729da55873a | 30 | PwmOut _m2b; |
12104404 | 15:7729da55873a | 31 | DigitalOut _m1dir; |
12104404 | 15:7729da55873a | 32 | DigitalOut _m2dir; |
alaurens | 19:5832e34b7533 | 33 | void setXstate(int *xCurrState, int *xTarget,bool xGood,bool angleGood,int *angleGoal); |
alaurens | 19:5832e34b7533 | 34 | void setAngleTol(int *angleTol,bool yGood, bool xGood); |
alaurens | 19:5832e34b7533 | 35 | void setYgoal(bool xGood,bool angleGood,bool yGood,int *yTarget); |
alaurens | 19:5832e34b7533 | 36 | void adjustY(int XcurrState,int Ytarget); |
12104404 | 18:f9012e93edb8 | 37 | bool setXPos(int target, int current, int error, int angle); |
12104404 | 18:f9012e93edb8 | 38 | bool setYPos(int target, int current, int error, int angle); |
12104404 | 15:7729da55873a | 39 | bool setAngle(int target, int current, int error, int mode); |
alaurens | 19:5832e34b7533 | 40 | void check_xya(bool *xGood,bool *yGood,bool *angleGood, int xGoal,int angleGoal,int yGoal,LOCALIZE_xya xya,int xErr, int yErr,int angleErr); |
12104404 | 15:7729da55873a | 41 | int wrap(int num); |
12104404 | 15:7729da55873a | 42 | |
12104404 | 15:7729da55873a | 43 | protected: |
12104404 | 17:2f89826b5679 | 44 | float s; |
12104404 | 6:0602a9e8118b | 45 | }; |
12104404 | 6:0602a9e8118b | 46 | #endif |