1
$\begingroup$

I am trying to understand finding the joint angles to a robot arm and i am reading this tutorial on a website and either i am really dense or it is wrong.. https://appliedgo.net/roboticarm/

The 5th picture from the top where the author starts to label angles for law of cosines, he previously states that Angle A1 is split into D1 and D2 and then he applies law of cosines but it looks more like Pythagorean theorem he is saying that angle D1^2 = X^2 + Y^2 which i dont understand ? He has two unknowns , side C and angle c, so how does he solve for law of cosines?

enter image description here

  • 0
    Editorial error in the picture, replace "D1" by "dist"2017-01-06
  • 0
    The pythagorean theorem is a specific case of the law of cosines when $C = 90\deg$ then $c^2 = a^2 + b^2 - 2ab\cos C = a^2 + b^2 + 2ab*0=a^2 + b^2$. In this case $D1$ equals the angle and the statement makes no sense whatsoever whether he uses low of cosines or pythagorean theorem. It's a typo. He meant $dist = \sqrt{a^2 + b^2}$ which is the pythagorean theorem/law of cosines with a right angle.2017-01-06
  • 0
    I've read the article closer... the guy was just wrong and sloppy. He should have said $D1 = \arctan (y, x)$. It's neither the p.t. or law of cos. It's just simply the definition of tan. By the time he wrote the program he caught it. He was probably careless. He needs a proof reader.2017-01-06

4 Answers 4

0

The figure is nonsense. As you say, the Pythagorean theorem involves side lengths, not angles. The correct way to compute D1 is via arctangent (as the author does do later in the code).

0

There are some errors in the text.

Picture must say $dist^2 = x^2+y^2$ and $D1=\text{atan2}(y,x)$.

Note code is ok:

dist := distance(x, y)
D1 := math.Atan2(y, x)
0

enter image description here

There is some messy on the author's text. There is a confusion between angle and length.

I will try to write something more clear.

Let's say that $\angle A= \angle D1+ \angle D2$.

We use Pythagoras in order to get $a=dist$:

$$a=\sqrt{x^2+y^2}$$

and use that to calculate $\angle D2$ by cosine rule:

$$c^2=a^2+b^2-2ab\cos (\angle D2) \rightarrow \angle D2=\arccos\left(\frac{a^2+b^2-c^2}{2ab}\right)$$

we also know that

$$\cos(\angle D1)=\frac{x}{a}\rightarrow \angle D1=\arccos\left(\frac{x}{a}\right)$$

Now you can calculate $\angle A= \angle D1+\angle D2$.

I hope this helps.

-1

The pythagorean theorem is just a generalization of the Law of Cosines.

As per your given link, the author first uses the pythagorean theorem to find out the value of $D1$. He then uses this value (by substituting it into the formula for the law of cosines) to find $D2$ by considering the second triangle (which is not right-angled).

He then reuses the Law of Cosines but considering another angle now $A2$ to find out its cosine. And Hence. he deduces the value of the angle itself.

In short, he uses the law of cosines two times. One to find out the side $D2$ and one time to find out $A2$

  • 0
    but how on earth is angle d1 equal to x^2 + y^2 ?2017-01-06
  • 0
    D1 and D2 are distances. They are NOT angles. The figure is a bit misleading. D1 is not the angle but the distance from the origin to (x,y) A1 and A2 are the angles.2017-01-06
  • 0
    the author must have been overworked or something because he clearly says "A1 = D1 + D2" and "dist divides angle A1 into two angles D1 and D2." which mean i cannot trust the rest of the math or code which sucks because advanced kinematics tutorials are rare2017-01-06
  • 0
    You are giving the author too much credit. The author clealy states: "Furthermore, dist divides angle A1 into two angles D1 and D2." In a late night typing with bad coffe, the author simply in typing the bit of "How to find the angle D1" saw his notes $dist = \sqrt{x^2 + y^2}$ and did a brain fart. He should have said "D1 is simple trig. tan D1 = opposite/adjacent =y/x so D1 = arctan y/x" but in his late night transcribing he got befuddled.2017-01-06
  • 0
    " which mean i cannot trust the rest of the math or code". That's a little harsh. It was a transcription carelessness. It's pretty clear through the rest of the article that the guy's not a complete idiot. He briefly, while typing his notes, got befuddled and thought D1 was the distance "dist" and described "dist" properly. The rest of the math and code seem (in five seconds skimming) to be fine. I mean a guy who *sincerely* does not understand the difference between an angle and a distance wouldn't have been able to coherently type *anything*.2017-01-06