Society of Robots  Robot Forum
Software => Software => Topic started by: idee17 on November 29, 2012, 08:59:56 PM

I have little experience with trigonometric functions, and was seeing if anyone can help me get some algorithms running for inverse kinematics. I have read of the robot arm tutorial with the inverse kinematics stuff and understood most of it, except the part with "psi" and "theta". I thought that those words are like variables that values assigned too (more programming experience then trig), if that's right, what symbol do they correspond to? Just one more thing, I'll be running the algorithms that are processing intense on my computer.
psi = arccos((x^2 + y^2  L1^2  L2^2) / (2 * L1 * L2))
theta = arcsin((y * (L1 + L2 * c2)  x * L2 * s2) / (x^2 + y^2))
where c2 = (x^2 + y^2  L1^2  L2^2) / (2 * L1 * L2);
and s2 = sqrt(1  c2^2);
~Thanks Idan

Psi and theta are just Greek letters that are commonly used to represent angles when applying equations to a geometry scenario, such as you posted. There is not set value for this letter, essentially it is just a variable that can be used to represent an angle.It is more so convention that Greek letters are used to label angles.
When you are writing programs you don't have to use these symbols, you can use any unique letter in your program. For example Psi could be swapped for A and theta could be swapped for B to make programming simpler.
Cheers,
Joker94

Θ  theta
Ψ  psi

Thanks for the fast responses guys, this will really help me out.

I realized a couple days ago that I would need a robot arm with 4 DOF instead of the 3 DOF arm example. I have looked at various websites and haven't found the equations that do what is needed. Also, the base angle could be ignore and have the inverse kinematics work in 2D. If anyone knows how to do this or could point me in the right direction it would be appreciated.
The FBD is attached...
~Thanks Idan

The thing with IK is that a twosegment IK has a closed form solution (well, two solutions, as it's a quadratic equation.) Three segments can still be reduced to two, if you use the first axis to select a solution plane and then sove the twosegment case. This is what I do for my quadroped walker, for example  the hip points the legs in the right direction; the two knees position the tip of the foot in the right place.
For more than three segments, or for the case of three segments that are all coplanar, you no longer have a nice quadratic equation that gives you the solution. There are generally infinitely many solutions, and the math is not closedform anymore. There are two solutions used in general: Iterative solutions, and overconstrained solutions.
The idea behind iterative solutions is that, if you start out with a particular solution, and then move the goal a small way, then you can look for the smallest delta to the IK solution that solves for the new goal. This is popular in animation software, for example, where two characters may be holding hands, and we want the contact point to be roughly between the center of gravity of the two characters. The drawback is that you're not guaranteed anything in particular about the solution, because what it is depends on how you got there.
The idea behind overconstraining is to add constraints to the solution that aren't necessarily encoded in the physics, and thus reduce it to a set of twosegment problems you can solve in order. For example, for a threesegment leg, getting the toetop at a particular point could be done where the last segments joint is positioned anywhere on a circle around the desired end point. If you define that the last segment joint should always be straight up from the contact point, for example, the circle collapses to a point, and you can solve the first two segments for that point, and then solve the last segment trivially to reach the goal. (The "walker" solution I suggest above is actually a special case of this method.)
So, if you're not comfortable with the math just yet, now's probably a good time to pull up the textbooks, or go to khanacademy.org or mathworld.wolfram.com to brush up on it!

Thanks for the response, it answered a lot of my questions. I have been reading up on IK and think I have found a paper publish by MIT that seems to have all the information necessary to begin coding it into the algorithms to control the arm. I will most definitely read about the two solutions you mentioned and work on my math skills from some of those sites you mentioned, I haven't obtained the math skills yet :'( (in Algebra 2 right now). Tell me what you think about the paper, here is the link ↓
http://ocw.mit.edu/courses/mechanicalengineering/212introductiontoroboticsfall2005/lecturenotes/chapter4.pdf (http://ocw.mit.edu/courses/mechanicalengineering/212introductiontoroboticsfall2005/lecturenotes/chapter4.pdf)
~Thanks

The book chapter/paper is an excellent find. I saved a copy for my own reference. It describes the same approach I've used for IK stuff, and is thus just what you need.

http://ocw.mit.edu/courses/mechanicalengineering/212introductiontoroboticsfall2005/lecturenotes/chapter4.pdf (http://ocw.mit.edu/courses/mechanicalengineering/212introductiontoroboticsfall2005/lecturenotes/chapter4.pdf)
This is not actually a "paper" (as that typically means a peerreviewed journal publication,) it is lecture notes / course materials for a class at MIT that teaches these things.
That being said, that's exactly what you want  if you can figure this out, you'll be in good shape!
The more I get into robots, the more I find that the math I learned from computer graphics, animation, and physics simulation is totally applicable, btw. That shows all those who said computer games would amount to nothing ;)

Oh, never really knew the definition of a "paper" thanks for the advice =) I'll start getting it coded for the robot arm. When ever i get it finish i'll be sure to post the code that i ended up with, for others to use...
ps: I going to keep playing and making computer games :D
~Thanks Idan