Makes kinematics params be based on config

This commit is contained in:
Rune Harlyk
2025-09-04 19:08:54 +02:00
parent 1799889712
commit 767d1157df
4 changed files with 31 additions and 53 deletions
+17 -13
View File
@@ -16,10 +16,10 @@ class KinConfig {
#elif defined(SPOTMICRO_ESP32_MINI)
static constexpr float coxa = 35.0f / 100.0f;
static constexpr float coxa_offset = 0.0f / 100.0f;
static constexpr float femur = 52.0f / 100.0f;
static constexpr float tibia = 65.0f / 100.0f;
static constexpr float L = 120.0f / 100.0f;
static constexpr float W = 78.5f / 100.0f;
static constexpr float femur = 60.0f / 100.0f;
static constexpr float tibia = 60.0f / 100.0f;
static constexpr float L = 160.0f / 100.0f;
static constexpr float W = 80.0f / 100.0f;
#elif defined(SPOTMICRO_YERTLE)
static constexpr float coxa = 35.0f / 100.0f;
static constexpr float coxa_offset = 0.0f;
@@ -33,25 +33,29 @@ class KinConfig {
{L / 2, 0, W / 2}, {L / 2, 0, -W / 2}, {-L / 2, 0, W / 2}, {-L / 2, 0, -W / 2}};
static constexpr float default_feet_positions[4][4] = {
{mountOffsets[0][0], -1, mountOffsets[0][2] + coxa, 1},
{mountOffsets[1][0], -1, mountOffsets[1][2] - coxa, 1},
{mountOffsets[2][0], -1, mountOffsets[2][2] + coxa, 1},
{mountOffsets[3][0], -1, mountOffsets[3][2] - coxa, 1},
{mountOffsets[0][0], 0, mountOffsets[0][2] + coxa, 1},
{mountOffsets[1][0], 0, mountOffsets[1][2] - coxa, 1},
{mountOffsets[2][0], 0, mountOffsets[2][2] + coxa, 1},
{mountOffsets[3][0], 0, mountOffsets[3][2] - coxa, 1},
};
// Max constants
static constexpr float max_roll = 15 * (float)M_PI_2;
static constexpr float max_pitch = 15 * (float)M_PI_2;
static constexpr float max_body_shift_x = 0.25;
static constexpr float max_body_shift_z = 0.25;
static constexpr float max_body_shift_x = W / 3;
static constexpr float max_body_shift_z = W / 3;
static constexpr float max_body_height = 1;
static constexpr float max_leg_reach = femur + tibia - coxa_offset;
static constexpr float min_body_height = max_leg_reach * 0.45;
static constexpr float max_body_height = max_leg_reach * 0.9;
static constexpr float body_height_range = max_body_height - min_body_height;
static constexpr float max_step_length = 1;
// Default constant
static constexpr float default_step_depth = 0.002;
static constexpr float default_body_height = 0.5;
static constexpr float default_step_height = 0.4;
static constexpr float default_body_height = min_body_height + body_height_range / 2;
static constexpr float default_step_height = default_body_height / 2;
};