Inverse Kinematics
Simulation of a 2-segment arm, calculates arm joint angles based on input (x,y) coordinates. Description behind the calculations in my inverse kinematics angle joint calculator tool
Step 1: Calculate the Distance the arm needs to stretch
First step is to calculate .
From the pythagorean theorem:
Step 1 note:
Compare to arm segments total
length:
to check if target location can be
reached
Step 2: Calculate Joint #2 Angle
Next step is to calculate . This is the
angle for the second joint.
From the law of cosines:
Step 3: Calculate Joint #1 Angle
To calculate we take the difference
between an assumed position (A,B) where the L1 segment is at whatever position we have defined as 0˚,
so in this case, laying along the +x axis.
Angles of Interest
: Joint #1 angle, our calculated result.
Theta “Target” is the angle that is made up from the origin to the target (x,y) coordinates.
Theta “Actual” is the angle that is made up from the origin to the end of the arm (A,B) when the L1 segment is at 0˚.
Calculating A and B:
Find the desired joint 1 angle by subtracting the target by the actual.