2D Inverse Kinematics Solver
- Project Type
- Python, matplotlib
- Year
- 2023
A Python program to solve and animate the inverse kinematics of a SCARA robotic arm. It can follow straight lines or trace user-defined paths.
01
Stepping the angles or the path
I wrote this Python program to work out how a SCARA robot arm needs to move, then animate it with matplotlib. Between the same two points, it can either step both joint angles at a steady rate or keep the tip on a straight line.
Stepping the angles keeps both joint curves perfectly straight, but the tip swings along an arc. Stepping the path keeps the tip on the line, but this line passes close to the base, and there the shoulder angle drops sharply in a very short stretch of time.
02
Tracing a path of my own
The program can also follow a path you define. Here the tip traces a smooth, hump-shaped path, with both joint angles plotted over time on the left and every pose the solver found fanned out on the right.
I drew each pose faintly and let the color fade from red at the start of the move to blue at the end, so a single image shows the whole motion and which way it went.