# the necessity of yaw angle limitation

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 close merge delete

Sort by » oldest newest most voted

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.

more

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].

( 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.

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