Ask Your Question

the necessity of yaw angle limitation

asked 2018-02-21 07:33:15 -0500

sasadasd gravatar image

updated 2018-02-21 07:36:08 -0500

Hello , currently,I worked on cording the odometry_tf node.

I have something to ask about limitation of yaw angle. According to the following URL, the yaw angle of robot(th) is not limited .

  38     th += delta_th;

  41     geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th);

In this case,I think that the "th" is gradually increasing and the value of odom_quat will be nan. Is this allright?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-22 08:33:35 -0500

TL;DR: Yes "th" is gradually increasing and possibly exceeding bounds of (-pi,pi], but it doesn't matter. You'll always get the "right" quaternion.

What would cause the quaternion value be NaN? This is actually one of the benefits of a quaternion -- for describing any arbitrary rotation, there are only two possible quaternions. This is opposed to a 3-parameter description of rotation (like any of the family of Euler angles) where there are infinite choices that all yield the same rotation. In your specific question the same quaternion will be produced for $th = th + 2 n pi$ for any choice of integer n. In other words for any yaw angle you'll always get the same quaternion regardless of how many "wraps" around the unit circle you have.

If you look at the source code for createQuaternionMsgFromYaw, you'll see that they actually call tf::Quaternion.setRPY to calculate the values of the quaternion. If you look at the source code for the setRPY method you'll see it's just a bunch of sin and cos calls that also don't matter how many wraps you have.

edit flag offensive delete link more


Thank your for your helpful advice!

Actually, I encountered the issue that my navigation robot is not capable of making map due to the difference between sensing position by lidar and estimated position by odometory. At that time ,I set the limitation of yaw angle(-pi,pi].

sasadasd gravatar image sasadasd  ( 2018-02-23 17:09:58 -0500 )edit

I took your opinion as reference and I comment out the limitation of yaw angle, then my robot is capable of making map well.

sasadasd gravatar image sasadasd  ( 2018-02-23 17:11:16 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-02-21 07:33:15 -0500

Seen: 337 times

Last updated: Feb 22 '18