Files
hexapod-robot/2026-current/hardware/openscad/robot.scad
T

36 lines
1.4 KiB
OpenSCAD
Raw Normal View History

// The whole 2026 hexapod: body (body.scad) plus six legs (leg.scad),
// placed and posed like robot/Config.h. Robot frame: +X forward (switch
// end), +Y left, +Z up, Z = 0 on the bottom plate's top face.
use <body.scad>
use <leg.scad>
/* [Pose] */
// "original" = the Fusion model's pose; "stand" = firmware stance
// (Kinematics::neutralStance(): feet 130 mm out, 150 mm down).
POSE_NAME = "stand"; // [original, stand]
// Optional per-leg override, [coxa, femur, tibia] in degrees, legs 0..5.
POSE_OVERRIDE = [];
// Leg mounts from robot/Config.h: x, y, mount angle (0..2 right, 3..5 left).
// Hexagon layout: corner legs 60 deg round from the mid legs.
LEG_MOUNT = [[100, -50, -30], [0, -65, -90], [-100, -50, -150],
[-100, 50, 150], [0, 65, 90], [100, 50, 30]];
JOINT_PLANE_Z = 13.5; // femur/knee axes, halfway up the body cavity
POSES = [["original", [0, 0, -90]], ["stand", [0, -1.2, -98.3]]];
function base_pose() = [for (p = POSES) if (p[0] == POSE_NAME) p[1]][0];
function leg_pose(i) = len(POSE_OVERRIDE) == 6 ? POSE_OVERRIDE[i] : base_pose();
module robot() {
body_assembly();
for (i = [0:5]) {
m = LEG_MOUNT[i];
p = leg_pose(i);
translate([m[0], m[1], JOINT_PLANE_Z])
if (m[2] > 0) rotate([0, 0, m[2]]) leg(p);
else mirror([0, 1, 0]) rotate([0, 0, -m[2]]) leg([-p[0], p[1], p[2]]);
}
}
robot();