version2
Dependencies: BNO055_fusion mbed
Fork of DEMO2 by
Diff: LOCOMOTION.h
- Revision:
- 15:7729da55873a
- Parent:
- 6:0602a9e8118b
- Child:
- 16:d6f15a13c3aa
diff -r 4839989ae907 -r 7729da55873a LOCOMOTION.h --- a/LOCOMOTION.h Thu Mar 24 03:54:29 2016 +0000 +++ b/LOCOMOTION.h Thu Mar 24 07:20:51 2016 +0000 @@ -3,19 +3,28 @@ #include "mbed.h" -typedef struct { - uint8_t m1f; - uint8_t m1b; - uint8_t m2f; - uint8_t m2b; - bool f1; - bool f2; -} LOCOMOTION_speed; +#define SPEED_TURN_MIN 0.15 +#define SPEED_TURN_MAX 0.35 + +enum { + ANGLE_TURN = 0, + ANGLE_BIAS = 1, +}; class LOCOMOTION { public: - LOCOMOTION(PwmOut& motor1F, PwmOut& motor1B,PwmOut& motor2F, PwmOut& motor2B, DigitalOut& forward1, DigitalOut& forward2); - LOCOMOTION_speed _speed; + 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; + bool setAngle(int target, int current, int error, int mode); + int wrap(int num); + +protected: + }; #endif \ No newline at end of file