1
votes

I recently had to convert euler rotation rates to vectorial angular velocity. From what I understand, in a local referential, we can express the vectorial angular velocity by:

R = [rollRate, pitchRate, yawRate] (which is the correct order relative to the referential I want to use).

I also know that we can convert angular velocities to rotations (quaternion) for a given time-step via:

alpha = |R| * ts
nR = R / |R| * sin(alpha) <-- normalize and multiply each element by sin(alpha)
Q = [nRx i, nRy j, nRz k, cos(alpha)]

When I test this for each axis individually, I find results that I totally expect (i.e. 90°pitch/time-unit for 1 time unit => 90° pitch angle).

When I use two axes for my rotation rates however, I don't fully understand the results:

For example, if I use rollRate = 0, pitchRate = 90, yawRate = 90, apply the rotation for a given time-step and convert the resulting quaternion back to euler, I obtain the following results:

(ts = 0.1)  Roll:  0.712676, Pitch:  8.96267, Yaw:   9.07438
(ts = 0.5)  Roll: 21.058,    Pitch: 39.3148,  Yaw:  54.9771
(ts = 1.0)  Roll: 76.2033,   Pitch: 34.2386,  Yaw: 137.111

I Understand that a "smooth" continuous rotation might change the roll component mid way.

What I don't understand however is after a full unit of time with a 90°/time-unit pitchRate combined with a 90°/time-unit yawRate I end up with these pitch and yaw angles and why I still have roll (I would have expected them to end up at [0°, 90°, 90°].

I am pretty confident on both my axis + angle to quaternion and on my quaternion to euler formulas as I've tested these extensively (both via unit-testing and via field testing), I'm not sure however about the euler rotation rate to angular-velocity "conversion".

My first bet would be that I do not understand how euler rotation-rates axes interacts on themselves, my second would be that this "conversion" between euler rotation-rates and angular velocity vector is incorrect.

1

1 Answers

1
votes

Euler angles are not good way of representing arbitrary angular movement. Its just a simplification used for graphics,games and robotics. They got some pretty hard restrictions like your rotations consist of only N perpendicular axises in ND space. That is not how rotation works in real world. On top of this spherical representation of reper endpoint it creates a lot of singularities (you know when you cross poles ...).

The rotation movement is analogy for translation:

position       speed                    acceleration
pos = Integral(vel) = Integral(Integral(acc))
ang = Integral(omg) = Integral(Integral(eps))

That in some update timer can be rewritten to this:

vel+=acc*dt; pos+=vel*dt;
omg+=eps*dt; ang+=omg*dt;

where dt is elapsed time (Timer interval).

The problem with rotation is that you can not superimpose it like translation. As each rotation has its own axis (and it does not need to be axis aligned, nor centered) and each rotation affect the axis orientation of all others too so the order of them matters a lot. On top of all this there is also gyroscopic moment creating 3th rotation from any two that has not parallel axis. Put all of this together and suddenly you see Euler angles does not match the real geometrics/physics of rotation. They can describe orientation and fake its rotation up to a degree but do not expect to make real sense once used for physic simulation.

The real simulation would require list of rotations described by the axis (not just direction but also origin), angular speed (and its change) and in each simulation step the recomputing of the axis as it will change (unless only single rotation is present).

This can be done by using coumulative homogenous transform matrices along with incremental rotations.

Sadly the majority of programmers prefers Euler angles and Quaternions simply by not knowing that there are better and simpler options and once they do they stick to Euler angles anyway as matrix math seem to be more complicated to them... That is why most nowadays games have gimbal locks, major rotation errors and glitches, unrealistic physics.

Do not get me wrong they still have their use (liek for example restrict free look for camera etc ... but they missused for stuff they are the worse option to use for.