2026: OpenSCAD robot and remote, physical joint limits, model in Unity
hardware/openscad/ rebuilds the broken Fusion models as OpenSCAD: body (top/bottom plate, standoffs, battery bay, switch), legs (coxa bracket, femur link, tibia, horn adapters, TPU socks, servo cables), the whole robot, and the remote (shell, lid, Nextion 3.5", JH-D400X-R4 sticks, 18650 UPS board, IMU, Teensy 4.0, USB-C breakout). Every part was checked by slicing against the original STEP solids; the original's bugs are fixed and listed in PLANNING.md. The robot now uses a hexagon leg layout (corner legs 60 deg round from the mid legs; the corner coxa brackets need turning on their splines). Physical limits from a collision sweep of the model are in Config.h: per-leg coxa limits and LEG_CLEARANCE_MM 56 (a leg is 55.2 mm wide at the joints); the sim API exports them (version 7). sim_smoke passes. Unity loads the model (export_unity.py -> Resources/OpenScadModel, OpenScadModel.cs builds a new rig in place of the old scene's robot). The PCB model's mounting holes now use the exact EasyEDA grid. README shows renders of both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1c94e4149
commit
91b5b99fd5
42 files changed
+1560
-20
No files matched your search
@@ -9,12 +9,19 @@
|
||||
// ---- Leg geometry ----
|
||||
// Taken from the Unity model (Hexapod_Simulation_Unity/Assets/Main.unity,
|
||||
// 1 Unity unit = 10 mm): hip pivots at x = +-10 / 0, z = +-5 / +-6.5;
|
||||
// coxa 5.5, femur 10, tibia 15. BENCH: confirm against the real chassis.
|
||||
// coxa 5.5, femur 10, tibia 15. Confirmed exactly against the real
|
||||
// chassis's CAD (hardware/openscad, from the Fusion model): coxa axes at
|
||||
// these mounts, coxa 55 / femur 100 / tibia 150 mm to the centre of the
|
||||
// 10 mm foot ball. The femur and knee axes lie in the coxa pivot plane
|
||||
// (Z = 0), 13.5 mm above the bottom plate's top face.
|
||||
constexpr int NUM_LEGS = 6;
|
||||
// Leg order: 0=front-right, 1=mid-right, 2=rear-right, 3=rear-left, 4=mid-left, 5=front-left
|
||||
// Angles measured counterclockwise from the body's +X (forward) axis, viewed from above.
|
||||
// This is the direction the coxa points at servo center: straight sideways on this chassis.
|
||||
constexpr float LEG_MOUNT_ANGLE_DEG[NUM_LEGS] = { -90, -90, -90, 90, 90, 90 };
|
||||
// This is the direction the coxa points at servo center. Hexagon layout (owner's
|
||||
// request): mid legs straight sideways, front/rear legs 60 deg further round, so
|
||||
// all six are 60 deg apart. BENCH: the corner coxa brackets sit 60 deg round on
|
||||
// their servo splines (4 teeth of 24) compared with the old sideways layout.
|
||||
constexpr float LEG_MOUNT_ANGLE_DEG[NUM_LEGS] = { -30, -90, -150, 150, 90, 30 };
|
||||
constexpr float LEG_MOUNT_X_MM[NUM_LEGS] = { 100, 0, -100, -100, 0, 100 };
|
||||
constexpr float LEG_MOUNT_Y_MM[NUM_LEGS] = { -50, -65, -50, 50, 65, 50 };
|
||||
|
||||
@@ -23,7 +30,19 @@ constexpr float FEMUR_LEN_MM = 100.0f;
|
||||
constexpr float TIBIA_LEN_MM = 150.0f;
|
||||
|
||||
// ---- Joint limits, degrees ----
|
||||
constexpr float COXA_MIN_DEG = -60, COXA_MAX_DEG = 60;
|
||||
// Physical limits from the OpenSCAD model (hardware/openscad, collision
|
||||
// sweep of the real parts, see PLANNING.md "Physical limits"), and servo
|
||||
// travel (+-90 coxa/femur, -180..0 tibia):
|
||||
// coxa mid legs -66.5 .. 66.5 coxa bracket shell hits the plate
|
||||
// coxa 0 front-right, 3 rear-left -95.75 .. 66.75 (servo: -90)
|
||||
// coxa 2 rear-right, 5 front-left -66.75 .. 95.75 (servo: 90)
|
||||
// femur -101 .. 101 femur link hits the coxa bracket (servo: 90)
|
||||
// tibia -177 .. 12.75 rod folds into the femur link / shell hits it (servo: 0)
|
||||
// The limits below keep ~3 deg from those and the earlier software limits
|
||||
// where those are tighter. Per leg, because the corner legs' ranges differ (in
|
||||
// the old sideways layout they could only swing ~36 deg towards the mid leg).
|
||||
constexpr float COXA_MIN_DEG[NUM_LEGS] = { -60, -60, -60, -60, -60, -60 };
|
||||
constexpr float COXA_MAX_DEG[NUM_LEGS] = { 60, 60, 60, 60, 60, 60 };
|
||||
constexpr float FEMUR_MIN_DEG = -80, FEMUR_MAX_DEG = 80;
|
||||
constexpr float TIBIA_MIN_DEG = -150, TIBIA_MAX_DEG = -20;
|
||||
|
||||
@@ -41,8 +60,10 @@ constexpr float STANCE_HEIGHT_RATE_MM_S = 60.0f;
|
||||
// ---- Leg collision ----
|
||||
// Minimum distance between the center lines of neighbouring legs' segments
|
||||
// (coxa, femur, tibia). Gait strides and body poses are scaled down to keep
|
||||
// it. BENCH: set to roughly the width of a leg (servo body + bracket).
|
||||
constexpr float LEG_CLEARANCE_MM = 30.0f;
|
||||
// it. From the OpenSCAD model: at the joints a leg reaches 33.7 mm to its
|
||||
// horn side (rear) and 21.5 mm to its bearing side (front), so two
|
||||
// neighbours touch at 55.2 mm between center lines.
|
||||
constexpr float LEG_CLEARANCE_MM = 56.0f;
|
||||
|
||||
// ---- Servos (Teensy 3.6, hardware PWM at SERVO_PWM_HZ) ----
|
||||
// One entry per servo: pulse = us_at_0deg + us_per_deg * joint_deg, clamped
|
||||
|
||||
@@ -51,7 +51,7 @@ JointAngles Kinematics::solve(int i, const FootTarget& target) {
|
||||
out.femur_deg = degrees(femur_rad);
|
||||
out.tibia_deg = degrees(tibia_rad);
|
||||
|
||||
if (out.coxa_deg < COXA_MIN_DEG || out.coxa_deg > COXA_MAX_DEG) out.valid = false;
|
||||
if (out.coxa_deg < COXA_MIN_DEG[i] || out.coxa_deg > COXA_MAX_DEG[i]) out.valid = false;
|
||||
if (out.femur_deg < FEMUR_MIN_DEG || out.femur_deg > FEMUR_MAX_DEG) out.valid = false;
|
||||
if (out.tibia_deg < TIBIA_MIN_DEG || out.tibia_deg > TIBIA_MAX_DEG) out.valid = false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user