I am building a robot arm and im trying to get the claw-end of it to move linearly. So both horizontally and vertically. the arm consists of two joints, like a shoulder and elbow. I'm trying to use trigonometry to do the calculations for this, but i have no idea how to approach this in Arduino code, is it even possible for an Uno?
Is there some library or something that could help with the trigonometry?
Hi,
Good question. IsThere some notation for multiple axes that defines the relative angles and motion? Some algorithm to derive a third motion? Some serious robot guys must have done this...
The two parts of the arm are fixed in length. You know how far the desired position is from the shoulder by the Pythagorean Theorem: Distance = sqrt(xDistancexDistance+yDistanceyDistance). That gives you the third side of the triangle from which you can calculate the elbow angle.
You can get the shoulder angle from trig because the xDistance and yDistance are two sides of a right triangle. The Distance calculated above is the Hypotenuse. Sine is Opposite/Hypotenuse so the Shoulder angle is arcsin(yDistance/Distance).
You now have the two angles to feed to your servos.