# Most accurate rotation representation for small angles

Assume that I have a rigid body for which I know that it can rotate with respect to a global reference frame (which is considered fixed and already given) for only a few degrees of angle, so I can describe its rotation by using the small angle approximation. For this system, I would like to know if there is a rotation representation that offers more accuracy when compared with other representation methods.

The main representation methods that I considered are the euler angles and the pitch-yaw-roll transformation. To my perception, I think that pitch-yaw-roll representation is expected to be more accurate, since all the angles are expressed with respect to the initial coordinate frame. On the other hand, euler angles are defined on different frames, so I am not sure if the resulting angles will be really small.

To sum up, I know that the body can rotate for only a few degrees and I would like to know which coordinate representation is much probable to deliver the smallest angles, such that the small angle approximation is more valid.

It could also be the case that there is not a general answer (so it depends on the specific configuration) but still I haven't found anything about this topic on the related literature!

Example (no small angle approx used): Assume I have a coordinate frame which describes a point in space by the following vector

$P2=\begin{bmatrix} 4 \\ 1 \\ 0.05 \end{bmatrix}$.

Given another coordinate frame which is rotated with respect to the previous one, the description of the same point is given by

$P1=\begin{bmatrix} 3.8933 \\ 1.3566 \\ -0.0630 \end{bmatrix}$.

Using Euler angles, I can find that the rotation matrix $R_{euler}$ is characterized by the angles $0.1,0.2,0.1$ rads, which correspond to the angle of rotation around z axis, the rotation around the resulting y axis and the rotation around the resulting z axis, respectively (these are basic stuff, it is explained in many books.). So I have that $P1=R_{euler} P2$.

Now I want to find the corresponding rotation matrix if I use the pitch-yaw-roll representation. Here I have to solve an optimization problem and the solution that I get (maximum error between P1 and the estimated P1 is $3 \times 10^{-8}$) delivers me the following angles

$\begin{bmatrix} -0.0103 \\ 0.0257 \\ 0.0902\end{bmatrix}$,

which correspond to the rotation around the x,y and z axis of the initial coordinate frame.

• Truth is invariant under change of notation. You can't turn your pickup truck into a Ferrari by describing it in polar coordinates or a different frame of reference. – Bending Unit 22 Apr 11 '16 at 12:59
• How about using quaternions? See this question – Code Poetics Apr 11 '16 at 18:14
• It would still be a truck, even using quaternions – holmeski Apr 11 '16 at 21:59
• @CodePoetics it seems that you get what I want to do here! However, I haven't considered quaternions yet because I would like to avoid for now the fact that they need for parameters to define the rotation. But I definitely have to consider them. For now I have restricted my search in euler-type of rotations, that is to say, rotations around 3 different axes. – jpro Apr 12 '16 at 18:39
• Is this a question about how to minimize the error that you'll get when you start encoding all these values as floating-point (finite precision) values in a computer program? – Ian Apr 23 '16 at 23:52

@jpro, I think you are not understanding something about kinematics. Whether you use Euler angles, or homogeneous transforms, or rotation matrices, or quaternians, or any other kinematic representation, ALL of them relate the object's pose with respect to some coordinate frame. If you refer back to a reference coordinate frame located at the end of the robot's forearm (or the wrist center if the wrist is spherical), you will ensure that any errors caused by the kinematics of the arm joints are not part of your equations. But you can pick which type of kinematic model you use and you should find the same accuracy for them all.

The Rotation Matrix is unique. See the answers here: https://math.stackexchange.com/questions/105264/3d-rotation-matrix-uniqueness

Each term of this 3x3 can be represented many ways, as you are trying to do. A silly example: If one of your angles is $\theta_1$, you could instead write it as the sum of ten smaller angles. But $R$ would be the same. There is probably a way to represent each of the nine terms with a minimum (least-squares) set of terms. But $R$ will be the same.

One more edit (sorry):

$R$ is orthonormal. That puts six constraints on the nine terms ($||R|| = 1$, the magnitude of each row (and column) is also 1, and the rows and columns are mutually orthogonal). So you have three degrees of freedom to play with. There is your optimization problem. Pick any representation, and as you find different ways to represent those nine terms, it may be challenging to relate that back to the physical system. I believe you will end up at screw coordinates. You may want to research canonical kinematics for ideas. But I suspect you will find different robot geometries, and different motion goals, will result in a change for which standard notation results in the smallest angles.

• Thanks for the answer. Maybe my question was not that clear. I agree that all transformations give the location of the same point with respect to the same coordinate frame, if properly done. However, each rotation representation uses a different set of angles to describe the same object. Now, in my application, I want to estimate the 6 variables used in the transformation matrix using a set of 9 lasers by only knowing that the angles are small. So, I would like to know if there exists a rotation representation that is expected to express the position of the object using smaller angle values. – jpro Apr 11 '16 at 14:25
• @jpro: this is an XY problem. Your real problem is how to do that measurement properly and how to set up the lasers. But the question you asked here is about some solution you came up with (find some other representation for angle values), which includes (possibly wrong) assumptions and restrictions of the underlying real problem which we have no clue about. This is why your question is so unclear. Please ask a new question about the actual problem that you have. It sounds like an interesting one. – Bending Unit 22 Apr 11 '16 at 15:02
• @BendingUnit22: I think I avoided the XY problem since I avoided mentioning my approach for a specific problem, but I tried to present the question in a more general framework. The general question is: given a rotation of a body for "small" angles, find the rotation representation whose angles are taking the smallest values. – jpro Apr 11 '16 at 15:18
• @jpro: forget about the whole small angle stuff! You have this idea stuck in your head that small angles are good and that it is your mission now to apply them to this problem no matter what. Take a step back and explain the original task you have. At the moment it appears to me that you're the guy with the hammer trying to see a nail in something that ain't one. – Bending Unit 22 Apr 11 '16 at 15:44
• What you are trying to do by transforming general displacements and rotations into some kind of other transformation, which results in smaller angles, does not make sense. Angles are preserved under these mathematical constructs. Look into screw theory - you can use any modeling methodology you want, and it can be ultimately decomposed into a single screw axis, with a computed pitch, and a single rotation, to accomplish that transformation. You can't change what the angles "look like." – SteveO Apr 11 '16 at 16:25

It sounds to me like you want something where you can (exaggerating) express 30 degrees as thirty 1 degree transforms, such that you can then do something where $\sin{(1)} \approx 1$ and "cheat" that transform to use $\sin{(30)}\approx 30$.

You can't do this, because as BendingUnit22 put it, "Truth is invariant under change of notation."

It's similar to saying, "Well, a mile is 5280 feet, and a foot is 12 inches, and each inch is 25.4mm, and a millimeter is basically nothing, so a mile is a 1.6 million times nothing, so a mile is nothing." It doesn't work because there is error with any approximation, and that error propagates with every successive step.

• thanks for the answer. I don't want to do this, because it doesn't make sense! What I am investigating is if there is a representation that describes a point using smaller angle values. To give another example (which is not what I want to do here, but still shows the general idea), one could say that an object travelled 4m to the x direction and 4 to the y. Another one could define his axes to be rotated 45deg. anti-clockwise w.r.t. the previous ones, so he could say that the object travelled 5.65m to the new x axis. Hope this clarifies a bit my problem! – jpro Apr 11 '16 at 14:40
• @jpro: ok, now the object goes back to 0 on the (original) Y axis. How do you describe that position now? Change frame of reference again? Now how do you measure the (not small) angles of the frame of reference? You might as well say that in its own local frame of reference the object doesn't ever move at all. All angles are zero. Great, but is that helpful? Your problem needs a lot clarification, because so far you only described the problems of some abstract mathematical description of it, which may or may not be correct. – Bending Unit 22 Apr 11 '16 at 15:32
• @jpro - I think this is exactly what you're trying to do. You're trying to find some other means of expression such that you can approximate. So, instead of saying "miles" you say "millimeters" and make the approximation that millimeters are negligible. Or, I think to put it your way, "The Earth only rotated a fraction of a degree, so the mile is negligible." Is this not correct? Rather than using the actual distance (a mile) you want a different frame that lets you use a small angle approximation. If you want to abuse it, nobody here can stop you, but we can say you're doing it wrong. – Chuck Apr 11 '16 at 19:12
• There are cases where the question can make sense, if intended as: how to maximize the accuracy vs the range of the parameter. Ex: If the angle varies between 0 and 180 degrees, then I can use 1 byte and the LSb represents a degree. But if the angle is always between 0 and 90 degrees, then I can use the LSb to represent half degree, thus doubling the precision. – Igor Stoppa Apr 12 '16 at 6:32
• @Chuck I don't know how familiar you are with different rotation representations, so maybe the question is not clear to you. Please take a look at the example that I added to see that I don't do any "magic" but I am just trying to use the tools that are the most appropriate for what I want to achieve, if there are any of course (if I knew the answer I wouldn't ask!). – jpro Apr 12 '16 at 12:37

There is one option (I'm tempted to write trick) that might help you. in a limited set of conditions.

uC / uP systems are exceedingly good at measuring time.

So, if you can either assume that the speed is constant or that you can compensate for changes, you could convert your measurements of angles into measurements of time (i.e. how long does it take to reach a certain angular position).

This would enable faster fixed point math and you could even build calibration tables for the motors.

But it really depends on the specific application if anything of what I described can bring any benefit.

As I understand it, quaternions have the least issues with numerical approximations or discontinuities for a sequence of mujltiple rotations. See this explanation of Quaternions, plus all the quaternion- and rotation-related pages on that site. You'll also get numerical errors when you convert between representations.

However, for single rotations rather than chained sequences of rotations (hence minimal numerical approx errors) most of the other answers here are correct: the representations are equivalent. Just avoid Euler a-b-c sequences like XYZ, ZXY, etc. to avoid gimbal lock.

edit: you can see how representation conversions lead to numerical approximations, from the code on this page - lots of trigonometric functions.