1
$\begingroup$

I have a turtle bot and I want to modify its heading so it moves to certain point (x,y) in the world.

Now I reckon that yaw is angle from robots reference, how do I determine the yaw as the point (x,y) is from global (world's reference)?

$\endgroup$
1
$\begingroup$

This is basic geometry/trigonometry. Here is an image of your situation (the plane being your turtle bot, and the red circle being your target ($x$,$y$).

enter image description here

You want your turtle bot to first turn to face the target and then head towards it. So first you need to compute your desired heading ($\theta_t$)

This is basic trigonometry: $$ tan(\theta_t) = \frac{y_t-y}{x_t - x} \Rightarrow \theta_t = atan(\frac{y_t-y}{x_t - x})$$

So you need to turn your robot of $\theta - \theta_t$ to face your target first.

$\endgroup$
2
  • $\begingroup$ it is so clear with a picture. thanks $\endgroup$ Feb 21 at 16:09
  • $\begingroup$ You welcome. Pictures always help ;) $\endgroup$
    – ejalaa12
    Feb 21 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.