Forward and inverse Kinematics:
I started this project in Desmos by creating two polygons and calculated their relative coordinates based on a user-defined angle. After translating those relative coordinates to global ones, I finally had a working arm.
At first, I had to manually adjust the angles to make the tip reach a target. I knew there had to be a better way. I wanted to just click a point and have the arm calculate the math on its own.
That led me down the rabbit hole of Inverse Kinematics (IK).
The Roadblock:
After researching the math, I threw it into Desmos, but something was broken. The angle of joint 2 was completely off.
After digging deeper, I realized my mistake. I was calculating the angle of segment 2 relative to segment 1, but the renderer actually needed the angle relative to the origin.
The Breakthrough
The math did not click for me until I imagined a person walking up a hill. If you are climbing a slope and reach a peak, you need to know the exact change in your angle to keep moving along the new path.
To solve this, I extended the first segment line and found the supplementary angle to my original calculation. Once I applied that shift, the arm snapped perfectly into place.
Now, the arm seamlessly calculates its own angles and reaches the goal point automatically.
I then implemented the same Math into my Python project
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.