Library to control a 3DOF leg with a PCA9685.
HEXAPOD_LEG.h@5:50039ebd3a8d, 2016-05-03 (annotated)
- Committer:
- el13cj
- Date:
- Tue May 03 10:57:31 2016 +0000
- Revision:
- 5:50039ebd3a8d
- Parent:
- 3:9cc530686346
All good baby
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el13cj | 0:ead365546ca5 | 1 | #ifndef HEXAPOD_LEG_LIBRARY_H |
el13cj | 0:ead365546ca5 | 2 | #define HEXAPOD_LEG_LIBRARY_H |
el13cj | 0:ead365546ca5 | 3 | |
el13cj | 0:ead365546ca5 | 4 | #include "PCA9685.h" |
el13cj | 0:ead365546ca5 | 5 | #include "mbed.h" |
el13cj | 0:ead365546ca5 | 6 | #include "structs.h" |
el13cj | 0:ead365546ca5 | 7 | |
el13cj | 0:ead365546ca5 | 8 | class Hexapod_Leg { |
el13cj | 0:ead365546ca5 | 9 | |
el13cj | 0:ead365546ca5 | 10 | public: |
el13cj | 0:ead365546ca5 | 11 | Hexapod_Leg(PCA9685 Driver, calibrated_leg_centre leg_cent, calibrated_leg_1_degree leg_step, leg_outputs leg_out, bool ON_RHS); |
el13cj | 0:ead365546ca5 | 12 | void set_joint_angles(float angle_a, float angle_b, float angle_c); |
el13cj | 3:9cc530686346 | 13 | void set_leg_position(leg_x_angles angles); |
el13cj | 0:ead365546ca5 | 14 | |
el13cj | 0:ead365546ca5 | 15 | private: |
el13cj | 0:ead365546ca5 | 16 | float angle_to_pwm(float angle, char joint); |
el13cj | 0:ead365546ca5 | 17 | |
el13cj | 0:ead365546ca5 | 18 | private: |
el13cj | 0:ead365546ca5 | 19 | float a_ref; |
el13cj | 0:ead365546ca5 | 20 | float b_ref; |
el13cj | 0:ead365546ca5 | 21 | float c_ref; |
el13cj | 0:ead365546ca5 | 22 | |
el13cj | 0:ead365546ca5 | 23 | float a_1deg; |
el13cj | 0:ead365546ca5 | 24 | float b_1deg; |
el13cj | 0:ead365546ca5 | 25 | float c_1deg; |
el13cj | 0:ead365546ca5 | 26 | |
el13cj | 0:ead365546ca5 | 27 | int a_pin; |
el13cj | 0:ead365546ca5 | 28 | int b_pin; |
el13cj | 0:ead365546ca5 | 29 | int c_pin; |
el13cj | 0:ead365546ca5 | 30 | |
el13cj | 0:ead365546ca5 | 31 | bool RHS; |
el13cj | 0:ead365546ca5 | 32 | |
el13cj | 0:ead365546ca5 | 33 | PCA9685 driver; |
el13cj | 0:ead365546ca5 | 34 | |
el13cj | 0:ead365546ca5 | 35 | }; |
el13cj | 0:ead365546ca5 | 36 | |
el13cj | 0:ead365546ca5 | 37 | |
el13cj | 0:ead365546ca5 | 38 | |
el13cj | 0:ead365546ca5 | 39 | |
el13cj | 0:ead365546ca5 | 40 | #endif |