Library to control a 3DOF leg with a PCA9685.
structs.h@5:50039ebd3a8d, 2016-05-03 (annotated)
- Committer:
- el13cj
- Date:
- Tue May 03 10:57:31 2016 +0000
- Revision:
- 5:50039ebd3a8d
- Parent:
- 4:4d4cea424b7f
All good baby
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 | 2:40956b2ed45b | 18 | calibrated_leg_centre leg_cent[7] = |
el13cj | 0:ead365546ca5 | 19 | { |
el13cj | 0:ead365546ca5 | 20 | // A B C |
el13cj | 2:40956b2ed45b | 21 | {0, 0, 0 }, //Dummy Leg for better structure |
el13cj | 1:4c98fa9a06a4 | 22 | {1520, 1570, 2474}, //LEG 1 |
el13cj | 1:4c98fa9a06a4 | 23 | {1500, 1494, 2440}, //LEG 2 |
el13cj | 1:4c98fa9a06a4 | 24 | {1535, 1449, 2524}, //LEG 3 |
el13cj | 1:4c98fa9a06a4 | 25 | {1472, 1537, 485 }, //LEG 4 |
el13cj | 2:40956b2ed45b | 26 | {1504, 1520, 587 }, //LEG 5 |
el13cj | 2:40956b2ed45b | 27 | {1455, 1493, 553 }, //LEG 6 |
el13cj | 0:ead365546ca5 | 28 | }; |
el13cj | 0:ead365546ca5 | 29 | |
el13cj | 0:ead365546ca5 | 30 | |
el13cj | 0:ead365546ca5 | 31 | typedef const struct leg_angles calibrated_leg_1_degree; |
el13cj | 0:ead365546ca5 | 32 | |
el13cj | 2:40956b2ed45b | 33 | calibrated_leg_1_degree leg_step[7] = |
el13cj | 0:ead365546ca5 | 34 | { |
el13cj | 0:ead365546ca5 | 35 | // A B C |
el13cj | 2:40956b2ed45b | 36 | {0, 0, 0 }, //Dummy Leg for better structure |
el13cj | 1:4c98fa9a06a4 | 37 | {10.444, 10.500, 10.778}, //LEG 1 |
el13cj | 1:4c98fa9a06a4 | 38 | {10.722, 10.811, 10.478}, //LEG 2 |
el13cj | 1:4c98fa9a06a4 | 39 | {10.633, 10.644, 10.822}, //LEG 3 |
el13cj | 1:4c98fa9a06a4 | 40 | {10.744, 10.700, 10.478}, //LEG 4 |
el13cj | 1:4c98fa9a06a4 | 41 | {10.744, 10.511, 10.811}, //LEG 5 |
el13cj | 1:4c98fa9a06a4 | 42 | {10.733, 11.011, 10.478}, //LEG 6 |
el13cj | 0:ead365546ca5 | 43 | }; |
el13cj | 0:ead365546ca5 | 44 | |
el13cj | 0:ead365546ca5 | 45 | |
el13cj | 0:ead365546ca5 | 46 | struct pwm_outputs |
el13cj | 0:ead365546ca5 | 47 | |
el13cj | 0:ead365546ca5 | 48 | { |
el13cj | 0:ead365546ca5 | 49 | int a; |
el13cj | 0:ead365546ca5 | 50 | int b; |
el13cj | 0:ead365546ca5 | 51 | int c; |
el13cj | 0:ead365546ca5 | 52 | |
el13cj | 0:ead365546ca5 | 53 | }; |
el13cj | 0:ead365546ca5 | 54 | |
el13cj | 0:ead365546ca5 | 55 | |
el13cj | 0:ead365546ca5 | 56 | typedef const struct pwm_outputs leg_outputs; |
el13cj | 0:ead365546ca5 | 57 | |
el13cj | 0:ead365546ca5 | 58 | leg_outputs leg_out[3] = |
el13cj | 0:ead365546ca5 | 59 | { |
el13cj | 3:9cc530686346 | 60 | // A B C |
el13cj | 4:4d4cea424b7f | 61 | {0, 1, 2}, //FRONT LEG |
el13cj | 4:4d4cea424b7f | 62 | {3, 4, 5}, //MID LEG |
el13cj | 4:4d4cea424b7f | 63 | {6, 7, 8}, //REAR LEG |
el13cj | 0:ead365546ca5 | 64 | }; |
el13cj | 0:ead365546ca5 | 65 | |
el13cj | 3:9cc530686346 | 66 | typedef const struct leg_angles leg_x_angles; |
el13cj | 0:ead365546ca5 | 67 | |
el13cj | 0:ead365546ca5 | 68 | #endif |