E.R.I.C.'s first attempt to walk
Dependencies: mbed AX12_Hardware
FK.h@0:8a7c1e92d067, 2011-10-16 (annotated)
- Committer:
- ms523
- Date:
- Sun Oct 16 16:01:08 2011 +0000
- Revision:
- 0:8a7c1e92d067
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ms523 | 0:8a7c1e92d067 | 1 | #include "mbed.h" |
ms523 | 0:8a7c1e92d067 | 2 | #include "AX12.h" |
ms523 | 0:8a7c1e92d067 | 3 | |
ms523 | 0:8a7c1e92d067 | 4 | #define B 45 // Offset dimension |
ms523 | 0:8a7c1e92d067 | 5 | #define FEMUR 80 // Femur length |
ms523 | 0:8a7c1e92d067 | 6 | #define TIBIA 140 // Tibia length |
ms523 | 0:8a7c1e92d067 | 7 | #define ULNA 90 // Ulna length |
ms523 | 0:8a7c1e92d067 | 8 | #define RADIUS 120 // Radius length |
ms523 | 0:8a7c1e92d067 | 9 | #define X_OFFSET 25 // Distance from the X-axis -> servo centre |
ms523 | 0:8a7c1e92d067 | 10 | #define PI 3.14159 |
ms523 | 0:8a7c1e92d067 | 11 | |
ms523 | 0:8a7c1e92d067 | 12 | #define HIND 0 |
ms523 | 0:8a7c1e92d067 | 13 | #define FORE 1 |
ms523 | 0:8a7c1e92d067 | 14 | |
ms523 | 0:8a7c1e92d067 | 15 | /********** Global structures **********/ |
ms523 | 0:8a7c1e92d067 | 16 | struct Joint_Angles { |
ms523 | 0:8a7c1e92d067 | 17 | float lateral; |
ms523 | 0:8a7c1e92d067 | 18 | float hip; |
ms523 | 0:8a7c1e92d067 | 19 | float knee; |
ms523 | 0:8a7c1e92d067 | 20 | }; |
ms523 | 0:8a7c1e92d067 | 21 | |
ms523 | 0:8a7c1e92d067 | 22 | /************************************************************************** |
ms523 | 0:8a7c1e92d067 | 23 | Global variables |
ms523 | 0:8a7c1e92d067 | 24 | **************************************************************************/ |
ms523 | 0:8a7c1e92d067 | 25 | extern AX12 Fore_Right_Hip_Lateral, |
ms523 | 0:8a7c1e92d067 | 26 | Fore_Right_Hip, |
ms523 | 0:8a7c1e92d067 | 27 | Fore_Right_Knee, |
ms523 | 0:8a7c1e92d067 | 28 | Fore_Left_Hip_Lateral, |
ms523 | 0:8a7c1e92d067 | 29 | Fore_Left_Hip, |
ms523 | 0:8a7c1e92d067 | 30 | Fore_Left_Knee, |
ms523 | 0:8a7c1e92d067 | 31 | Hind_Right_Hip_Lateral, |
ms523 | 0:8a7c1e92d067 | 32 | Hind_Right_Hip, |
ms523 | 0:8a7c1e92d067 | 33 | Hind_Right_Knee, |
ms523 | 0:8a7c1e92d067 | 34 | Hind_Left_Hip_Lateral, |
ms523 | 0:8a7c1e92d067 | 35 | Hind_Left_Hip, |
ms523 | 0:8a7c1e92d067 | 36 | Hind_Left_Knee; |
ms523 | 0:8a7c1e92d067 | 37 | |
ms523 | 0:8a7c1e92d067 | 38 | /********** Functions **********/ |
ms523 | 0:8a7c1e92d067 | 39 | void FK_Engine(float*); |
ms523 | 0:8a7c1e92d067 | 40 | void Set_Pose(const int*, float); |
ms523 | 0:8a7c1e92d067 | 41 | Joint_Angles IK_Engine(int, int, int, char); |
ms523 | 0:8a7c1e92d067 | 42 | void Step_Forward(int); |
ms523 | 0:8a7c1e92d067 | 43 | |
ms523 | 0:8a7c1e92d067 | 44 | /************ Define Poses ************/ |
ms523 | 0:8a7c1e92d067 | 45 | extern const int Stand[]; |
ms523 | 0:8a7c1e92d067 | 46 | extern const int Sit1[]; |
ms523 | 0:8a7c1e92d067 | 47 | extern const int Sit2[]; |
ms523 | 0:8a7c1e92d067 | 48 | extern const int Sit3[]; |
ms523 | 0:8a7c1e92d067 | 49 | extern const int Sit4[]; |