![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
wheelchair code for driver assitance
Fork of wheelchairalexa by
wheelchair.h@12:0e5a0571b497, 2018-08-17 (annotated)
- Committer:
- ryanlin97
- Date:
- Fri Aug 17 03:10:39 2018 +0000
- Revision:
- 12:0e5a0571b497
- Parent:
- 11:75f0f13ff6c1
code for driver assistance;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ryanlin97 | 0:fc0c4a184482 | 1 | #ifndef wheelchair |
ryanlin97 | 0:fc0c4a184482 | 2 | #define wheelchair |
ryanlin97 | 11:75f0f13ff6c1 | 3 | #include "mbed.h" |
ryanlin97 | 0:fc0c4a184482 | 4 | |
ryanlin97 | 11:75f0f13ff6c1 | 5 | #define turn_precision 10 |
ryanlin97 | 0:fc0c4a184482 | 6 | #define def (2.5f/3.3f) |
ryanlin97 | 0:fc0c4a184482 | 7 | #define high 3.3f |
ryanlin97 | 3:a5e71bfdb492 | 8 | #define offset .02f |
ryanlin97 | 3:a5e71bfdb492 | 9 | #define low (1.7f/3.3f) |
ryanlin97 | 10:e5463c11e0a0 | 10 | #define process .1 |
ryanlin97 | 11:75f0f13ff6c1 | 11 | #define xDir D9 |
ryanlin97 | 11:75f0f13ff6c1 | 12 | #define yDir D10 |
ryanlin97 | 0:fc0c4a184482 | 13 | |
ryanlin97 | 0:fc0c4a184482 | 14 | class Wheelchair |
ryanlin97 | 0:fc0c4a184482 | 15 | { |
ryanlin97 | 0:fc0c4a184482 | 16 | public: |
ryanlin97 | 7:5e38d43fbce3 | 17 | Wheelchair(PinName xPin, PinName yPin, Serial* pc, Timer* time); |
ryanlin97 | 12:0e5a0571b497 | 18 | void move(float x_coor, float y_coor, bool, bool, bool); |
ryanlin97 | 11:75f0f13ff6c1 | 19 | double turn_right(int deg); |
ryanlin97 | 11:75f0f13ff6c1 | 20 | double turn_left(int deg); |
ryanlin97 | 11:75f0f13ff6c1 | 21 | void turn(int deg); |
ryanlin97 | 1:c0beadca1617 | 22 | void forward(); |
ryanlin97 | 1:c0beadca1617 | 23 | void backward(); |
ryanlin97 | 1:c0beadca1617 | 24 | void right(); |
ryanlin97 | 1:c0beadca1617 | 25 | void left(); |
ryanlin97 | 1:c0beadca1617 | 26 | void stop(); |
ryanlin97 | 11:75f0f13ff6c1 | 27 | void compass_thread(); |
ryanlin97 | 0:fc0c4a184482 | 28 | |
ryanlin97 | 1:c0beadca1617 | 29 | private: |
ryanlin97 | 3:a5e71bfdb492 | 30 | PwmOut* x; |
ryanlin97 | 3:a5e71bfdb492 | 31 | PwmOut* y; |
ryanlin97 | 7:5e38d43fbce3 | 32 | Serial* out; |
ryanlin97 | 11:75f0f13ff6c1 | 33 | Timer* ti; |
ryanlin97 | 1:c0beadca1617 | 34 | |
ryanlin97 | 0:fc0c4a184482 | 35 | }; |
ryanlin97 | 0:fc0c4a184482 | 36 | #endif |