What are Inverse Kinematics?

Forward kinematics are used to determine the position of the end effector of a segmented armature or leg (or anything else with joints) with known values for the angles of each joint. This can sometimes be useful, but rarely do we want to know where the end of our robot arm or hexapod leg is going to end up if given some specific angles. Inverse kinematics are the opposite of forward kinematics, in that the position of the end effector is known, and the values of the angles are unknown. This is very useful if we want to move to a particular position, the problem is that the calculations required to determine the angles are significantly more complex than those of forward kinematics. I found two websites that were of some use to me: https://oscarliang.com/inverse-kinematics-and-trigonometry-basics/ and http://www.societyofrobots.com/robot_arm_tutorial.shtml.

Alright, Let's do Some Math!

I found it very useful to do some drawing in a notebook, because I can add and solve for angles more easily if they are right in front of me.

Originally, I tried to do too many things at once and attempt to accommodate for lots of positions, but as the code I created for that failed over and over, I decided to follow a more naïve approach and force the arm to take only one of the (sometimes two) possible paths to the point (x, y, z). Once that worked, I reintroduced the second route as an option, but favored the first route (meaning it only took the second route if the first failed).

More to come later