miguelasd688 / Quadruped-dog-like-robot

DIY project of a quadruped robot as a exercise for programming.
21 stars 7 forks source link

INVERSE KINEMATICS #1

Open fengmin2611 opened 4 years ago

fengmin2611 commented 4 years ago

Hello, I am very thankful for sharing your project. I am researching the code you wrote but do not understand the INVERSE KINEMATICS calculation. I found some other formulas about this and it is small different from your code. Can you explain and if you can share step by step to find this formula?

def solveIK_R(x,y,z): coxa=3.6 femur=6.1 tibia=9.4 D = (x**2+y**2-coxa**2+z**2-femur**2-tibia**2)/(2*tibia*femur) #siempre <1 D = checkdomain(D) gamma = numpy.arctan2(numpy.sqrt(1-D**2),D) tetta = -numpy.arctan2(-y,x)-numpy.arctan2(numpy.sqrt(x**2+y**2-coxa**2),-coxa) - numpy.pi/2 alpha = numpy.arctan2(z,numpy.sqrt(x**2+y**2-coxa**2))-numpy.arctan2(tibia*numpy.sin(gamma),femur+tibia*numpy.cos(gamma)) return tetta, alpha, gamma

Thank you very much

miguelasd688 commented 4 years ago

Hi, sorry for the late response, These equations are the results of transforming the forward kinematics, in the form x(angle), to the inverse kinematics, angle(x). This process is hard to do, as these functions are non-linear, blablabla. And constructing the forward kinematics depends hardly on the leg geometry, so these are the results for my geometry setup (whitch i copyed from internet) and, for another geometry, (for example, having an offset between the height of the coxa) it will change the result in a non trivial way. Thats why u saw other similar but no the same results. I'm sorry but i didnt go further solving the mathematical problem, i just search the inverse kinematic solution for my leg geometry.

I hope it has been helpful for you, thank you for the feedback!