Inverse kinematics was applied to determine the output angle of each servo for a desired position of the effector (xg,yg,zg). Each leg was solved individually. Cylindrical polar coordinates are used to take advantage of the circular symmetry. Each leg is projected into a 2D plane then basic geometry was used to determine the final servo output angle.
Cylindrical polar coordinates were used to take advantage of the circular symmetry present in the joint connections.