Most accurate rotation representation for small angles - Robotics Stack Exchange most recent 30 from robotics.stackexchange.com 2019-12-09T13:36:22Z https://robotics.stackexchange.com/feeds/question/9609 https://creativecommons.org/licenses/by-sa/4.0/rdf https://robotics.stackexchange.com/q/9609 2 Most accurate rotation representation for small angles jpro https://robotics.stackexchange.com/users/13415 2016-04-11T11:41:14Z 2019-06-28T00:41:16Z <p>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.</p> <p>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.</p> <p>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.</p> <p>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!</p> <p><strong>Example</strong> (no small angle approx used): Assume I have a coordinate frame which describes a point in space by the following vector</p> <p>$P2=\begin{bmatrix} 4 \\ 1 \\ 0.05 \end{bmatrix}$.</p> <p>Given another coordinate frame which is rotated with respect to the previous one, the description of the same point is given by </p> <p>$P1=\begin{bmatrix} 3.8933 \\ 1.3566 \\ -0.0630 \end{bmatrix}$.</p> <p>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$.</p> <p>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</p> <p>$\begin{bmatrix} -0.0103 \\ 0.0257 \\ 0.0902\end{bmatrix}$,</p> <p>which correspond to the rotation around the x,y and z axis of the initial coordinate frame. </p> https://robotics.stackexchange.com/questions/9609/-/9610#9610 3 Answer by SteveO for Most accurate rotation representation for small angles SteveO https://robotics.stackexchange.com/users/11125 2016-04-11T12:54:00Z 2016-04-23T18:15:48Z <p>@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, <em>ALL</em> 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.</p> <p>Edited based in your update:</p> <p>The Rotation Matrix is unique. See the answers here: <a href="https://math.stackexchange.com/questions/105264/3d-rotation-matrix-uniqueness">https://math.stackexchange.com/questions/105264/3d-rotation-matrix-uniqueness</a></p> <p>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. </p> <p>One more edit (sorry):</p> <p>$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. </p> https://robotics.stackexchange.com/questions/9609/-/9612#9612 2 Answer by Chuck for Most accurate rotation representation for small angles Chuck https://robotics.stackexchange.com/users/9720 2016-04-11T13:39:19Z 2016-04-11T13:39:19Z <p>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$.</p> <p>You can't do this, because as BendingUnit22 put it, "Truth is invariant under change of notation." </p> <p>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 <em>error</em> with any approximation, and that error propagates with every successive step. </p> https://robotics.stackexchange.com/questions/9609/-/9613#9613 0 Answer by Igor Stoppa for Most accurate rotation representation for small angles Igor Stoppa https://robotics.stackexchange.com/users/13414 2016-04-11T13:55:47Z 2016-04-11T13:55:47Z <p>There is one option (I'm tempted to write trick) that might help you. in a limited set of conditions.</p> <p>uC / uP systems are exceedingly good at measuring time.</p> <p>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).</p> <p>This would enable faster fixed point math and you could even build calibration tables for the motors.</p> <p>But it really depends on the specific application if anything of what I described can bring any benefit. </p> https://robotics.stackexchange.com/questions/9609/-/18996#18996 0 Answer by WillC for Most accurate rotation representation for small angles WillC https://robotics.stackexchange.com/users/14995 2019-06-28T00:33:14Z 2019-06-28T00:41:16Z <p>As I understand it, quaternions have the least issues with numerical approximations or discontinuities for a sequence of mujltiple rotations. See <a href="http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm" rel="nofollow noreferrer">this explanation of Quaternions</a>, plus all the quaternion- and rotation-related pages on that site. You'll also get numerical errors when you convert between representations.</p> <p>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 <a href="http://danceswithcode.net/engineeringnotes/rotations_in_3d/rotations_in_3d_part1.html" rel="nofollow noreferrer">gimbal lock</a>.</p> <p>edit: you can see how representation conversions lead to numerical approximations, from the code on <a href="http://www.kostasalexis.com/frame-rotations-and-representations.html" rel="nofollow noreferrer">this page</a> - lots of trigonometric functions.</p>