What is the math involved in inverse kinematics for a 6-DoF robotic arm? What does it take to build one from scratch?