Gordon Sulc
/
Bee
move.h@0:178a07cd3e39, 2011-12-16 (annotated)
- Committer:
- gsulc
- Date:
- Fri Dec 16 03:45:52 2011 +0000
- Revision:
- 0:178a07cd3e39
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gsulc | 0:178a07cd3e39 | 1 | #ifndef _MOVE_H |
gsulc | 0:178a07cd3e39 | 2 | #define _MOVE_H |
gsulc | 0:178a07cd3e39 | 3 | |
gsulc | 0:178a07cd3e39 | 4 | #include "mbed.h" |
gsulc | 0:178a07cd3e39 | 5 | #include "Motor.h" |
gsulc | 0:178a07cd3e39 | 6 | |
gsulc | 0:178a07cd3e39 | 7 | #define LEFT_C -1 |
gsulc | 0:178a07cd3e39 | 8 | #define RIGHT_C 1 |
gsulc | 0:178a07cd3e39 | 9 | #define FULL_FOWARD 1 |
gsulc | 0:178a07cd3e39 | 10 | #define FULL_REVERSE -1 |
gsulc | 0:178a07cd3e39 | 11 | #define NEUTRAL 0 |
gsulc | 0:178a07cd3e39 | 12 | #define LEFT -1 |
gsulc | 0:178a07cd3e39 | 13 | #define RIGHT 1 |
gsulc | 0:178a07cd3e39 | 14 | |
gsulc | 0:178a07cd3e39 | 15 | |
gsulc | 0:178a07cd3e39 | 16 | #define QTI_THRESH 0.48 |
gsulc | 0:178a07cd3e39 | 17 | |
gsulc | 0:178a07cd3e39 | 18 | #define TICS_PER_MM 40.8407045 |
gsulc | 0:178a07cd3e39 | 19 | |
gsulc | 0:178a07cd3e39 | 20 | typedef enum {Stopped, Moving} MovementState; |
gsulc | 0:178a07cd3e39 | 21 | extern MovementState move_state; |
gsulc | 0:178a07cd3e39 | 22 | |
gsulc | 0:178a07cd3e39 | 23 | extern AnalogIn r_encoder; |
gsulc | 0:178a07cd3e39 | 24 | extern AnalogIn l_encoder; |
gsulc | 0:178a07cd3e39 | 25 | extern AnalogIn srf; |
gsulc | 0:178a07cd3e39 | 26 | volatile extern int prev_r_enc; |
gsulc | 0:178a07cd3e39 | 27 | volatile extern int prev_l_enc; |
gsulc | 0:178a07cd3e39 | 28 | |
gsulc | 0:178a07cd3e39 | 29 | extern DigitalOut r_charge; |
gsulc | 0:178a07cd3e39 | 30 | extern DigitalOut l_charge; |
gsulc | 0:178a07cd3e39 | 31 | |
gsulc | 0:178a07cd3e39 | 32 | extern DigitalOut motor_reset; |
gsulc | 0:178a07cd3e39 | 33 | extern Motor r_motor; |
gsulc | 0:178a07cd3e39 | 34 | extern Motor l_motor; |
gsulc | 0:178a07cd3e39 | 35 | |
gsulc | 0:178a07cd3e39 | 36 | extern Serial pc; |
gsulc | 0:178a07cd3e39 | 37 | |
gsulc | 0:178a07cd3e39 | 38 | volatile extern int r_tics; |
gsulc | 0:178a07cd3e39 | 39 | volatile extern int l_tics; |
gsulc | 0:178a07cd3e39 | 40 | |
gsulc | 0:178a07cd3e39 | 41 | volatile extern int r_goal; |
gsulc | 0:178a07cd3e39 | 42 | volatile extern int l_goal; |
gsulc | 0:178a07cd3e39 | 43 | |
gsulc | 0:178a07cd3e39 | 44 | volatile extern float r_C; |
gsulc | 0:178a07cd3e39 | 45 | volatile extern float l_C; |
gsulc | 0:178a07cd3e39 | 46 | |
gsulc | 0:178a07cd3e39 | 47 | void moveforward(Motor right,float speed); |
gsulc | 0:178a07cd3e39 | 48 | void movebackward(Motor right,float speed); |
gsulc | 0:178a07cd3e39 | 49 | void move(float speed, int tics); |
gsulc | 0:178a07cd3e39 | 50 | void motors_stop(); |
gsulc | 0:178a07cd3e39 | 51 | void rotate(int); |
gsulc | 0:178a07cd3e39 | 52 | |
gsulc | 0:178a07cd3e39 | 53 | |
gsulc | 0:178a07cd3e39 | 54 | void QTIsensor_init(); |
gsulc | 0:178a07cd3e39 | 55 | void QTIsensor_charge(); |
gsulc | 0:178a07cd3e39 | 56 | void QTIsensor_discharge(); |
gsulc | 0:178a07cd3e39 | 57 | |
gsulc | 0:178a07cd3e39 | 58 | //Mine |
gsulc | 0:178a07cd3e39 | 59 | //extern MovementState move_state; |
gsulc | 0:178a07cd3e39 | 60 | |
gsulc | 0:178a07cd3e39 | 61 | //void accelerate(Motor m, float distance); |
gsulc | 0:178a07cd3e39 | 62 | //void move(int x, int y); |
gsulc | 0:178a07cd3e39 | 63 | //void move_line(float distance); |
gsulc | 0:178a07cd3e39 | 64 | //void rotate_deg(int degrees); |
gsulc | 0:178a07cd3e39 | 65 | //void rotate_t(float time); |
gsulc | 0:178a07cd3e39 | 66 | //void move_arc(int radius, int length, int x, int y); |
gsulc | 0:178a07cd3e39 | 67 | |
gsulc | 0:178a07cd3e39 | 68 | void calibrate(float speed, int rots); |
gsulc | 0:178a07cd3e39 | 69 | void update_movement(float speed); |
gsulc | 0:178a07cd3e39 | 70 | |
gsulc | 0:178a07cd3e39 | 71 | #endif |
gsulc | 0:178a07cd3e39 | 72 |