Is the information on the following link logical? - Robotics Stack Exchange most recent 30 from robotics.stackexchange.com 2020-01-28T08:39:26Z https://robotics.stackexchange.com/feeds/question/19174 https://creativecommons.org/licenses/by-sa/4.0/rdf https://robotics.stackexchange.com/q/19174 2 Is the information on the following link logical? muyustan https://robotics.stackexchange.com/users/23502 2019-07-29T16:03:37Z 2019-07-31T04:23:56Z <p>I cannot comment on the original answer, so I had to ask like this.</p> <p>I am trying to learn IMU's, accelerometers, gyros etc. for a while.</p> <p>So I came across with this answer below,</p> <p><a href="https://engineering.stackexchange.com/a/22182/21263">https://engineering.stackexchange.com/a/22182/21263</a></p> <blockquote> <p>From the accelerator sensor data, you can only calculate pitch and roll. The bellow document from Freescale explains with plenty of information what you need:</p> <p>[AN3461 - Tilt Sensing Using a Three-Axis Accelerometer]</p> <p>Based on the sayings of the document,</p> <p><span class="math-container">$$\tan \phi_{xyz} = \frac{G_{py}}{G_{pz}}$$</span></p> <p><span class="math-container">$$\tan \theta_{xyz} = \frac{-G_{px}}{G_{py}\sin \phi + G_{pz}\cos &gt; \phi} = \frac{-G_{px}}{\sqrt{G_{py}^2 + G_{pz}^2}}$$</span></p> <p>which equates to:</p> <pre><code>roll = atan2(accelerationY, accelerationZ) pitch = atan2(-accelerationX, sqrt(accelerationY*accelerationY + accelerationZ*accelerationZ)) </code></pre> <p>Of course, the result is this only when the rotations are occurring on a specific order (Rxyz):</p> <ol> <li>Roll around the x-axis by angle <span class="math-container">$\phi$</span></li> <li>Pitch around the y-axis by angle <span class="math-container">$\theta$</span></li> <li>Yaw around z-axis by angle <span class="math-container">$\psi$</span></li> </ol> <p>Depending on the rotations order, you get different equations. For the <span class="math-container">$R_{xyz}$</span> rotation order, you can not find the angle <span class="math-container">$\psi$</span> for the Yaw around z-axis.</p> <p>: <a href="https://cache.freescale.com/files/sensors/doc/app_note/AN3461.pdf" rel="nofollow noreferrer">https://cache.freescale.com/files/sensors/doc/app_note/AN3461.pdf</a><br> : <a href="https://i.stack.imgur.com/hSXgP.png" rel="nofollow noreferrer">https://i.stack.imgur.com/hSXgP.png</a></p> </blockquote> <p>But I don't see how the order of turn motions matters in case of getting pitch &amp; roll from accelerometer data. Without the histoy of orders, the accelerometer will give specific outputs at specific orientations.</p> <p>So what I am actually asking is whether the answer I shared is logical or not. Could you please clear the situation for me?</p> <p>Thanks.</p> https://robotics.stackexchange.com/questions/19174/-/19176#19176 1 Answer by morbo for Is the information on the following link logical? morbo https://robotics.stackexchange.com/users/23148 2019-07-29T20:22:30Z 2019-07-30T09:21:41Z <p>The Answer is logical simply because its a mathematical statement that explains how calculate Euler angles..from accel measurements...it also explains one of the caveats of using said system. Namely what was suggested in the comments</p> <p><a href="https://en.m.wikipedia.org/wiki/Gimbal_lock" rel="nofollow noreferrer">Gimbal lock</a></p> <p><a href="https://i.stack.imgur.com/xcbrG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xcbrG.jpg" alt="thing"></a></p> <p>From the <a href="https://upload.wikimedia.org/wikipedia/commons/4/49/Gimbal_Lock_Plane.gif" rel="nofollow noreferrer">wiki animation</a> one can see that the system can get stuck if rotated in a specific way causing them system to lock up and entire angles being completely gone. </p> <blockquote> <p>Gimbal locked airplane. When the pitch (green) and yaw (magenta) gimbals become aligned, changes to roll (blue) and yaw apply the same rotation to the airplane. -wiki</p> </blockquote> <p>This is one of the reasons <a href="https://en.m.wikipedia.org/wiki/Quaternion" rel="nofollow noreferrer">Quaternions</a> Are used as a way to measure angle as the dont suffer from the same issue as Euler angles, but are however difficult to visualize. </p> <blockquote> <p>Quaternions find uses in both pure and applied mathematics, in particular for calculations involving three-dimensional rotations such as in three-dimensional computer graphics, computer vision, and crystallographic texture analysis.<a href="https://en.m.wikipedia.org/wiki/Sensor_fusion" rel="nofollow noreferrer">5</a> In practical applications, they can be used alongside other methods, such as Euler angles and rotation matrices, or as an alternative to them, depending on the application.</p> </blockquote> <p>However, accels...are <em>generally</em>...useless by themselves if you want to calculate a real angle. As such one generally <a href="https://en.m.wikipedia.org/wiki/Sensor_fusion" rel="nofollow noreferrer">fuses them </a>with gyros and sometimes magnometers or other sensors to get a more stable and real measurement. </p> https://robotics.stackexchange.com/questions/19174/-/19185#19185 0 Answer by Chuck for Is the information on the following link logical? Chuck https://robotics.stackexchange.com/users/9720 2019-07-31T04:23:56Z 2019-07-31T04:23:56Z <blockquote> <p>Without the histoy of orders, the accelerometer will give specific outputs at specific orientations.</p> </blockquote> <p>Correct, <strong>but</strong> you might <em>define</em> a specific orientation ambiguously, and if you are ambiguous about it then you need to clarify. </p> <p>Consider this example: </p> <ol> <li>Rotate 180 degrees about your head-to-toe axis. Now you're facing the opposite direction as your original pose, then</li> <li>Rotate forward 90 degrees about your heel-to-heel axis. Now you're laying on your stomach (face-down), with your head pointed opposite of the direction you were originally facing.</li> </ol> <p>Now, keep the rotations the same, but change the order:</p> <ol> <li>Rotate forward 90 degrees about your heel-to-heel axis. Now you're laying on your stomach (face-down), with your head pointed <em>in the same direction</em> as you were originally facing, then</li> <li>Rotate 180 degrees about your head-to-toe axis. Now you are laying on your back (face-up), with your head pointed in the <em>same</em> direction as it was originally. </li> </ol> <p>Now, if you had an IMU/accelerometer in your hand, it would clearly give different readings for those two results, but that's because they're two different orientations. You can't just say it's 180 about this and 90 about that, you have to <em>specify</em> which rotation happens first if you want someone else to be able to understand. </p> <p>The way I think about it is that the order of rotation is an extra parameter in the description of the orientation. An angle about each of three axes and then an ordering of those axes. Four things to track: x, y, z, and the order in which they're applied. </p> <p>If you want to guarantee you're getting a pose right without having to worry about whether you're using the right formula, you may want to consider <em>quaternions.</em> They also happen to have four parameters, but they're not in any kind of sensible units. You can imagine what a 45 degree rotation about an x-axis looks like, but what does a quaternion look like? </p>