Library to control a 3DOF leg with a PCA9685.
structs.h@0:ead365546ca5, 2016-04-09 (annotated)
- Committer:
- el13cj
- Date:
- Sat Apr 09 18:57:46 2016 +0000
- Revision:
- 0:ead365546ca5
- Child:
- 1:4c98fa9a06a4
FINISHED AND WORKING MAY NEED CHANGES TO STRUCTS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el13cj | 0:ead365546ca5 | 1 | #ifndef HEXAPOD_LEG_STRUCTS_H |
el13cj | 0:ead365546ca5 | 2 | #define HEXAPOD_LEG_STRUCTS_H |
el13cj | 0:ead365546ca5 | 3 | |
el13cj | 0:ead365546ca5 | 4 | struct leg_angles |
el13cj | 0:ead365546ca5 | 5 | |
el13cj | 0:ead365546ca5 | 6 | { |
el13cj | 0:ead365546ca5 | 7 | |
el13cj | 0:ead365546ca5 | 8 | float a; //Body Joint |
el13cj | 0:ead365546ca5 | 9 | float b; //Mid Joint |
el13cj | 0:ead365546ca5 | 10 | float c; //End Joint |
el13cj | 0:ead365546ca5 | 11 | |
el13cj | 0:ead365546ca5 | 12 | }; |
el13cj | 0:ead365546ca5 | 13 | |
el13cj | 0:ead365546ca5 | 14 | //Calibrated centre positions for all six legs |
el13cj | 0:ead365546ca5 | 15 | |
el13cj | 0:ead365546ca5 | 16 | typedef const struct leg_angles calibrated_leg_centre; |
el13cj | 0:ead365546ca5 | 17 | |
el13cj | 0:ead365546ca5 | 18 | calibrated_leg_centre leg_cent[6] = |
el13cj | 0:ead365546ca5 | 19 | { |
el13cj | 0:ead365546ca5 | 20 | // A B C |
el13cj | 0:ead365546ca5 | 21 | {1500, 1545, 2480}, //LEG 1 |
el13cj | 0:ead365546ca5 | 22 | {1475, 1460, 2445}, //LEG 2 |
el13cj | 0:ead365546ca5 | 23 | {1520, 1450, 2490}, //LEG 3 |
el13cj | 0:ead365546ca5 | 24 | {1490, 1535, 490 }, //LEG 4 |
el13cj | 0:ead365546ca5 | 25 | {1480, 1500, 580 }, //LEG 5 |
el13cj | 0:ead365546ca5 | 26 | {1470, 1495, 550 }, //LEG 6 |
el13cj | 0:ead365546ca5 | 27 | }; |
el13cj | 0:ead365546ca5 | 28 | |
el13cj | 0:ead365546ca5 | 29 | |
el13cj | 0:ead365546ca5 | 30 | typedef const struct leg_angles calibrated_leg_1_degree; |
el13cj | 0:ead365546ca5 | 31 | |
el13cj | 0:ead365546ca5 | 32 | calibrated_leg_1_degree leg_step[6] = |
el13cj | 0:ead365546ca5 | 33 | { |
el13cj | 0:ead365546ca5 | 34 | // A B C |
el13cj | 0:ead365546ca5 | 35 | {10.889, 10.167, 10.778}, //LEG 1 |
el13cj | 0:ead365546ca5 | 36 | {10.444, 10.500, 10.444}, //LEG 2 |
el13cj | 0:ead365546ca5 | 37 | {10.667, 10.778, 10.389}, //LEG 3 |
el13cj | 0:ead365546ca5 | 38 | {10.556, 10.333, 10.111}, //LEG 4 |
el13cj | 0:ead365546ca5 | 39 | {10.361, 10.111, 10.611}, //LEG 5 |
el13cj | 0:ead365546ca5 | 40 | {10.806, 10.778, 10.222}, //LEG 6 |
el13cj | 0:ead365546ca5 | 41 | }; |
el13cj | 0:ead365546ca5 | 42 | |
el13cj | 0:ead365546ca5 | 43 | |
el13cj | 0:ead365546ca5 | 44 | struct pwm_outputs |
el13cj | 0:ead365546ca5 | 45 | |
el13cj | 0:ead365546ca5 | 46 | { |
el13cj | 0:ead365546ca5 | 47 | int a; |
el13cj | 0:ead365546ca5 | 48 | int b; |
el13cj | 0:ead365546ca5 | 49 | int c; |
el13cj | 0:ead365546ca5 | 50 | |
el13cj | 0:ead365546ca5 | 51 | }; |
el13cj | 0:ead365546ca5 | 52 | |
el13cj | 0:ead365546ca5 | 53 | |
el13cj | 0:ead365546ca5 | 54 | typedef const struct pwm_outputs leg_outputs; |
el13cj | 0:ead365546ca5 | 55 | |
el13cj | 0:ead365546ca5 | 56 | leg_outputs leg_out[3] = |
el13cj | 0:ead365546ca5 | 57 | { |
el13cj | 0:ead365546ca5 | 58 | // A B C |
el13cj | 0:ead365546ca5 | 59 | {0, 1, 2}, //FRONT LEG |
el13cj | 0:ead365546ca5 | 60 | {3, 4, 5}, //MID LEG |
el13cj | 0:ead365546ca5 | 61 | {6, 7, 8}, //REAR LEG |
el13cj | 0:ead365546ca5 | 62 | }; |
el13cj | 0:ead365546ca5 | 63 | |
el13cj | 0:ead365546ca5 | 64 | |
el13cj | 0:ead365546ca5 | 65 | |
el13cj | 0:ead365546ca5 | 66 | #endif |