Omnimaga

General Discussion => Other Discussions => Math and Science => Topic started by: Juju on October 25, 2011, 11:53:56 pm

Title: Inverse kinematics
Post by: Juju on October 25, 2011, 11:53:56 pm
Basically, I have a robotic arm (shown below), unfortunately the one I got is broken and I can't input XYZ coordinates directly so I have to convert them to angles for each of the joints.

(http://www.learnartificialneuralnetworks.com/images/rcfig1.jpg)

I know you need to use inverse kinematics for that (it gave headaches to my teacher), so I'm wondering if someone here knows about them. If so, please help me, thanks.
Title: Re: Inverse kinematics
Post by: z80man on October 26, 2011, 12:34:11 am
If you were to for example call the arm between joints 2 and three 2_3 and you wanted joint 3 at the xyz coordinate of (2,4,-8) in relation to joint 2, you would need to compute the inverse tangent to find the angle. To do so you need a right triangle with one angle at joint 2 and the other joint 3. Because this triangle is not aligned with the axis's you will need to break it down into 2 other triangles, one for y and the other for xz with their hypotenuses forming the legs of your final triangle. so if you solve for the Pythagorean theorem for x and z you get 8.246. Then because the xz leg is the opposite of the angle your solving for, you put it above the y leg which is the adjacent. So you would solve for the inverse tangent of 8.246/4 which equals 64.1 degrees. Now that is only part of the solution as you still need to find the rotation degree which is defined by x and z. Solving the inverse tangent for z over x yields a result of -75.96 degrees which is in the clockwise direction. So your final movement needs to be a clockwise rotation of 75.96 degrees and the arm needs to be bent to an angle of 64.1 degrees. The full formula for the bending angle is tan(-1)( sqrt((x)^2 + (z)^2) / y ) and the formula for rotation is tan(-1)( z / x ) All of this calculated with my trusty Prizm
Title: Re: Inverse kinematics
Post by: Juju on October 26, 2011, 12:42:43 am
Well, say the base frame is (0,0,0) and the tool frame is (2,4,-8), each of the articulations is, say, 20cm, and that's all I know (I don't care of XYZ positions of the angles in between), there's some way to calculate the 4 angles?
Title: Re: Inverse kinematics
Post by: z80man on October 26, 2011, 12:54:48 am
Well, say the base frame is (0,0,0) and the tool frame is (2,4,-8), each of the articulations is, say, 20cm, and that's all I know (I don't care of XYZ positions of the angles in between), there's some way to calculate the 4 angles?
Hmm that's far beyond my own knowledge of physics. It seems like either way you will have to calculate the xyz coordinate of each joint and have them all add up to your destination. You know that the points joint 3 for example could be forms a hollow sphere and each point upon that sphere is the center of another hollow sphere with each of those points being a possible position of joint 4 and the total shape is now a solid sphere with a diameter of 40 cm. How to calculate the individual angles though is something I can't figure out.
Title: Re: Inverse kinematics
Post by: Juju on October 26, 2011, 01:06:17 am
Thanks for helping anyway. I wonder if it's related to polar coordinates?
Title: Re: Inverse kinematics
Post by: Juju on October 27, 2011, 12:47:55 pm
Bump. I guess I'll just download a C++ library for that.
Title: Re: Inverse kinematics
Post by: Builderboy on October 27, 2011, 01:16:49 pm
The thing about inverse kinematics, is that the more joints you have, the more possible solutions for any given position.  I personally have only ever done 1 joint kinematics, and that's just simple trig, i have no idea how to do more x.x
Title: Re: Inverse kinematics
Post by: Adriweb on October 27, 2011, 02:51:38 pm
I guess that you have to take 2 fixed points so you can simply solve the last one.
but obviously, you have a looooot of solutions for a given (x,y) point.
Title: Re: Inverse kinematics
Post by: z80man on October 27, 2011, 05:24:10 pm
I think what you will need to do given the coordinates of the tool bench is to first generate a list of possible coordinates for each joint and then you can calculate the angles. Finding the angles is pure math but for finding possible coordinates you may have to use a guess and check approach. If given the tool bench coordinates the first thing you should do is find the distance between it and the base. Then knowing that each segment is 20cm and there were 5 of them that makes the distance 100cm when fully extended. With the comparison between the lengths then you can either approximate or exactly calculate what angles are needed to produce that distance using vector math. From there you could use a brute force approach to find to which joint each angle is acossiated with to match the original coordinates
Title: Re: Inverse kinematics
Post by: Juju on November 01, 2011, 06:22:41 pm
Update: Forget inverse kinematics, I don't need it anymore. My final project will involve controlling the arm with a Wiimote, which doesn't need any XYZ coordinate. It also have the side effect to be rather awesome. :P
Title: Re: Inverse kinematics
Post by: DJ Omnimaga on November 01, 2011, 06:34:37 pm
Hmm a wiimote sounds interesting. I unfortunately cannot help, though, because I know absolutely nothing about robotics, except that Protoss Collosi is OP (jk).
Title: Re: Inverse kinematics
Post by: Juju on November 01, 2011, 06:37:17 pm
Yeah I don't need help either, just telling you guys it'll be awesome ^_^ I'll try to record videos.