1

I am trying to find heading angle for my three wheeled robot my robot setup is as below Image

I know all co-ordinate values. (x1 y1) (x2 y2) two back wheels and (x3 y3) is front wheel co-ordinate

(xm ym) is the midpoint of (x1 y1) and (x2 y2)

(xt yt) is the target point

I am trying to find angle between (x3 y3) and (xt yt)

For the first case angle range must be 0 to +180 and for second case angle range must be 0 to -180 to make necessary turnings.

How can I use atan2 method for this? Is there any other better method to find angle in the necessary range?

ronroo
  • 25

1 Answers1

0

You have a line from (xm,ym) to (x3,y3) and another line between (xm,ym) and (xy,yt). Now all you interesting in is the angle between the two lines. The answer is here.

This is officially unanswered question, but the correct answer is there. Pick up the one with highest votes (Rory Daulton) and you good. Just use $\mathrm{atan2}$ instead of $\tan^{-1}$

  • Thanks for your reply I took few numerical examples and plotted on a graph. Equation 180 - |atan2(v1) - atan2(v2)| didn't work but this atan2(v1) - atan2(v2) works. Not sure I'm doing right or wrong – ronroo Oct 22 '15 at 22:45
  • you don't need the 180-.... thing, the atan2(v1) - atan2(v2) is the only thing you need, it is signed, so always work – Michael Medvinsky Oct 22 '15 at 22:56