PERSONAL · PYTHON2026 · ONGOING
2-joint robot arm simulator
Forward kinematics derived by hand, then inverse kinematics, a time-stepped simulation loop and a custom wireframe renderer. No robotics libraries. This panel is that math running live — drag the target, or use the arrow keys.
Where it’s headed: an arm clipped to the side of my desk that picks up stationery and drops my phone on its charger.
# arm/kinematics.py
def forward_kinematics(theta1, theta2):
theta1_rad = math.radians(theta1)
theta2_rad = math.radians(theta2)
elbow_x = L1 * math.cos(theta1_rad)
elbow_y = L1 * math.sin(theta1_rad)
hand_x = elbow_x + L2 * math.cos(theta1_rad + theta2_rad)
hand_y = elbow_y + L2 * math.sin(theta1_rad + theta2_rad)
return (elbow_x, elbow_y), (hand_x, hand_y)