|
37 | 37 | #define SERVO_SPEED_MIN 20 |
38 | 38 | #define SERVO_SPEED_MAX 80 |
39 | 39 |
|
40 | | -//#define DEBUG |
| 40 | +// #define DEBUG |
41 | 41 |
|
42 | 42 | #define SERVO_COUNT 8 // Number of servos to be controlled by ServoEasing |
43 | 43 |
|
44 | 44 | #define LEG_IK_MIN 75 // Min solvable height of leg between hip and ankle |
45 | | -#define LEG_IK_MAX 170 // Max solvable height of leg between hip and ankle |
| 45 | +#define LEG_IK_MAX 180 // Max solvable height of leg between hip and ankle |
46 | 46 |
|
47 | 47 | #define NOVAL 1000 |
48 | 48 |
|
49 | | -//#define MPU6050_ENABLED // Enable MPU6050 |
| 49 | +#define MPU6050_ENABLED // Enable MPU6050 |
50 | 50 | //#define MPU6050_DEBUG // Debug in serial plotter |
51 | | -//#define ANIMATE_ENABLED // Enable random animations |
52 | | - |
| 51 | +#define ANIMATE_ENABLED // Enable random animations |
53 | 52 |
|
54 | 53 | // Arrays to store servo min / max positions to avoid mechanical issues due |
55 | 54 | // NOTE: attach() disregards this, set PosRest to be within range of the servo's physical boundaries |
56 | | -int PosMin[SERVO_COUNT] = {0, 0, 5, 0, 0, 10, 60, 30}; |
| 55 | +int PosMin[SERVO_COUNT] = {0, 0, 5, 0, 0, 20, 60, 30}; |
57 | 56 | int PosMax[SERVO_COUNT] = {180, 180, 165, 180, 180, 180, 120, 150}; |
58 | 57 | int PosSleep[SERVO_COUNT] = {40, 60, 95, 140, 120, 85, PosMax[7], 90}; |
59 | 58 | //int PrepRestFromSleep[SERVO_COUNT] = {80, PosMin[1], PosMax[2], 100, PosMax[4], PosMin[5], S7_REST, 80, S9_REST}; |
60 | 59 | //int PrepSleepFromRest[SERVO_COUNT] = {S1_REST, S2_REST, S3_REST, S4_REST, S5_REST, S6_REST, S7_REST, 80, S9_REST}; |
61 | 60 |
|
62 | 61 | // Starting positions |
63 | 62 | //0, 3 = HIP |
64 | | -int PosStart[SERVO_COUNT] = {60, 0, 165, 120, 180, 10, 90, 90}; |
65 | | - |
| 63 | +int PosStart[SERVO_COUNT] = {60, 0, 165, 120, 180, 20, 90, 90}; |
66 | 64 |
|
| 65 | +int PosBackpack[SERVO_COUNT] = {45, 90, 165, 135, 90, 20, 90, 90}; // straighten legs and point feet to fit in backpack upright |
67 | 66 |
|
68 | 67 | //int PosRest[SERVO_COUNT] = {S1_REST, S2_REST, S3_REST, S4_REST, S5_REST, S6_REST, S7_REST, S8_REST, S9_REST}; |
69 | | -int PosRest[SERVO_COUNT] = {60, 0, 165, 120, 180, 10, 90, 90}; |
| 68 | +int PosRest[SERVO_COUNT] = {60, 0, 165, 120, 180, 20, 90, 90}; |
70 | 69 |
|
71 | 70 | int PosConfig[SERVO_COUNT] = {90, 90, 90, 90, 90, 90, 90, 90}; |
72 | 71 |
|
73 | 72 | // Poses |
74 | | -int PosStand[SERVO_COUNT] = {40, 60, 95, 140, 120, 85, NOVAL, NOVAL}; |
| 73 | +int PosStand[SERVO_COUNT] = {45, 75, 80, 135, 105, 100, NOVAL, NOVAL}; |
75 | 74 | int PosLookLeft[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, 180}; |
76 | 75 | int PosLookRight[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, 0}; |
77 | | -int PosLookRandom[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, -1, NOVAL}; // Made random by calling the function moveRandom() if the value is -1 |
| 76 | +int PosLookRandom[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, -1, -1}; // Made random by calling the function moveRandom() if the value is -1 |
78 | 77 | int PosLookUp[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, 60, 90}; |
79 | 78 | int PosLookDown[SERVO_COUNT] = {NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, NOVAL, 120, 90}; |
80 | 79 |
|
81 | 80 | // Array of poses except PosRest and PosSleep (which are used for initialization and reset of position) |
82 | 81 | int *Poses[] = {PosStand, PosLookLeft, PosLookRight, PosLookUp, PosLookDown, PosLookRandom}; |
83 | 82 |
|
| 83 | +int backpackPin = 12; |
| 84 | +bool backpack = false; |
| 85 | + |
| 86 | +int restrainPin = PIN_A1; |
| 87 | +bool restrainingBolt = false; |
| 88 | + |
84 | 89 | void blinkLED() |
85 | 90 | { |
86 | 91 | digitalWrite(LED_BUILTIN, HIGH); |
|
0 commit comments