A two-link arm reaches any point using inverse kinematics: given a target distance, the law of cosines gives the shoulder and elbow angles needed to place the gripper exactly there — the same math used by real construction and rover arms.
d = sqrt(r² + h²), clamped to |L1−L2| ≤ d ≤ L1+L2
elbow = π − acos((L1²+L2²−d²) / (2·L1·L2))
shoulder = atan2(h, r) + acos((L1²+d²−L2²) / (2·L1·d))
base yaw = atan2(targetZ, targetX)
- Autonomous build — lets the arm run its own pick-lift-place cycle, stacking regolith bricks into a wall.
- Manual target X / Z — when autonomous is off, drives the gripper to any point directly via inverse kinematics.
- Build speed — scales how fast the autonomous cycle moves between waypoints.
- Surface gravity — the Moon's 1.62 m/s² vs Earth's 9.8 m/s²; higher gravity makes dropped regolith dust fall faster and the loaded arm sag slightly more.
Real-world relevance: NASA and ESA lunar-base concepts rely on autonomous robotic arms exactly like this to 3D-print or stack regolith blocks into habitats before any human crew arrives.