Adds kinematics for spot pico

This commit is contained in:
Rune Harlyk
2025-08-22 12:21:12 +02:00
parent 251a791876
commit de3912ff10
4 changed files with 16 additions and 5 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
build_flags =
; Kinematics - Choose only one
-D SPOTMICRO_ESP32
;-D SPOTMICRO_YERTLE
; -D SPOTMICRO_ESP32_MINI
; -D SPOTMICRO_YERTLE
; Firmware flags
-D USE_SLEEP=1
+4 -2
View File
@@ -79,16 +79,18 @@
static_assert(!(USE_JSON == 1 && USE_MSGPACK == 1), "Cannot set both USE_JSON and USE_MSGPACK to 1 simultaneously");
#if defined(SPOTMICRO_ESP32) && defined(SPOTMICRO_YERTLE)
#if defined(SPOTMICRO_ESP32) && defined(SPOTMICRO_ESP32_MINI) && defined(SPOTMICRO_YERTLE)
#error "Only one kinematics variant must be defined"
#endif
#if !defined(SPOTMICRO_ESP32) && !defined(SPOTMICRO_YERTLE)
#if !defined(SPOTMICRO_ESP32) && !defined(SPOTMICRO_ESP32_MINI) && !defined(SPOTMICRO_YERTLE)
#error "You must define one kinematics variant"
#endif
#if defined(SPOTMICRO_ESP32)
#define KINEMATICS_VARIANT_STR "SPOTMICRO_ESP32"
#elif defined(SPOTMICRO_ESP32_MINI)
#define KINEMATICS_VARIANT_STR "SPOTMICRO_ESP32_MINI"
#elif defined(SPOTMICRO_YERTLE)
#define KINEMATICS_VARIANT_STR "SPOTMICRO_YERTLE"
#else
+9 -1
View File
@@ -29,6 +29,14 @@ class Kinematics {
static constexpr float L = 207.5f / 100.0f;
static constexpr float W = 78.0f / 100.0f;
#elif defined(SPOTMICRO_ESP32_MINI)
static constexpr float l1 = 0.0f / 100.0f;
static constexpr float l2 = 0.0f / 100.0f;
static constexpr float l3 = 52.0f / 100.0f;
static constexpr float l4 = 65.0f / 100.0f;
static constexpr float L = 120.0f / 100.0f;
static constexpr float W = 78.5f / 100.0f;
#elif defined(SPOTMICRO_YERTLE)
static constexpr float l1 = 35.0f / 100.0f;
static constexpr float l2 = 0.0f;
@@ -156,7 +164,7 @@ class Kinematics {
float theta2 = atan2f(z, G) - atan2f(l4 * sinf(theta3), l3 + l4 * cosf(theta3));
result[0] = RAD_TO_DEG_F(theta1);
result[1] = RAD_TO_DEG_F(theta2);
#if defined(SPOTMICRO_ESP32)
#if defined(SPOTMICRO_ESP32) || defined(SPOTMICRO_ESP32_MINI)
result[2] = RAD_TO_DEG_F(theta3);
#elif defined(SPOTMICRO_YERTLE)
result[2] = RAD_TO_DEG_F(theta3 + theta2);
+1 -1
View File
@@ -154,7 +154,7 @@ class MotionService {
float angles[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
float dir[12] = {1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1};
#if defined(SPOTMICRO_ESP32)
#if defined(SPOTMICRO_ESP32) || defined(SPOTMICRO_ESP32_MINI)
float rest_angles[12] = {0, 90, -145, 0, 90, -145, 0, 90, -145, 0, 90, -145};
float calibration_angles[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#elif defined(SPOTMICRO_YERTLE)