DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

pls help me understand pitch, roll and yaw angles in flight log

boblui

Well-Known Member
Joined
May 11, 2020
Messages
1,464
Reactions
1,208
Location
Hong Kong
I am trying to put together a set of Excel formulas for transforming the raw accelerometer data into xyz speed for crash analysis. In the thinking process. I got stuck in understanding the definition of pitch, roll and yaw provided in the log file.

Then I did a test with my M2P indoor. I put it into hovering at my chest level, grabbed it firmly with my hand, with the lateral axis of the craft maintaining level, I swang my arm down until the nose of the craft pointed to the floor. In actual flying, this will happen if both of the front motors suddenly lose thrust completely. This is a simple change in pitch angle from 0 deg to -90 deg plus some small loss in height. I did it twice.

Then I put the craft back to level and changed the roll angle from 0 deg to -90 deg by simply twisting my arm by that amount. Again, it was done twice.

The results are as follow. What puzzles me is that when I did the pitch change, the log indicated a simultaneous change in yaw and roll. Doesn't make sense to me. Does anyone know why ? The log file is attached. Sorry, no .DAT because my RC model is RC1B :(

The drone has been working flawlessly so faults can be ruled out.


1604297477116.png
 

Attachments

  • DJIFlightRecord_2020-11-02_[14-02-09].txt
    82.7 KB · Views: 6
Last edited:
I am trying to put together a set of Excel formulas for transforming the raw accelerometer data into xyz speed for crash analysis. In the thinking process. I got stuck in understanding the definition of pitch, roll and yaw provided in the log file.

Then I did a test with my M2P indoor. I put it into hovering at my chest level, grabbed it firmly with my hand, with the lateral axis of the craft maintaining level, I swang my arm down until the nose of the craft pointed to the floor. In actual flying, this will happen if both of the front motors suddenly lose thrust completely. This is a simple change in pitch angle from 0 deg to -90 deg plus some small loss in height. I did it twice.

Then I put the craft back to level and changed the roll angle from 0 deg to -90 deg by simply twisting my arm by that amount. Again, it was done twice.

The results are as follow. What puzzles me is that when I did the pitch change, the log indicated a simultaneous change in yaw and roll. Doesn't make sense to me. Does anyone know why ? The log file is attached. Sorry, no .DAT because my RC model is RC1B :(

The drone has been working flawlessly so faults can be ruled out.


View attachment 116355
Interesting. This occurred while the vision system was being used. Can you try this outside so that GPS is being used instead?

Also, can you try the experiment four times - pointed magNorth, magEast, magSouth and magWest.
 
Interesting. This occurred while the vision system was being used. Can you try this outside so that GPS is being used instead?

Also, can you try the experiment four times - pointed magNorth, magEast, magSouth and magWest.
Will do
 
I am trying to put together a set of Excel formulas for transforming the raw accelerometer data into xyz speed for crash analysis. In the thinking process. I got stuck in understanding the definition of pitch, roll and yaw provided in the log file.

Then I did a test with my M2P indoor. I put it into hovering at my chest level, grabbed it firmly with my hand, with the lateral axis of the craft maintaining level, I swang my arm down until the nose of the craft pointed to the floor. In actual flying, this will happen if both of the front motors suddenly lose thrust completely. This is a simple change in pitch angle from 0 deg to -90 deg plus some small loss in height. I did it twice.

Then I put the craft back to level and changed the roll angle from 0 deg to -90 deg by simply twisting my arm by that amount. Again, it was done twice.

The results are as follow. What puzzles me is that when I did the pitch change, the log indicated a simultaneous change in yaw and roll. Doesn't make sense to me. Does anyone know why ? The log file is attached. Sorry, no .DAT because my RC model is RC1B :(

The drone has been working flawlessly so faults can be ruled out.


View attachment 116355

You likely may have encountered the classic problem with the Tait-Byran angles that are used to represent pitch, roll and yaw. At a pitch of ± 90°, roll and yaw are equivalent and indeterminate. The condition is also referred to, misleadingly in my opinon, as gimbal lock. Anyway - for that reason you cannot reliably use Tait-Bryan angles to track orientation. Most systems, including DJI, use the quaternion representation, which does not suffer from that problem. Those are explicitly recorded in the DAT files, but are not in the txt logs, and while it is relatively trivial to recover the quaternions from the Tait_Bryan angles, it will fail at those singularities. That said, if you are working with the raw IMU data then obviously you have the DAT files, and can use the quaternions directly.

That's what I implemented to get the partial inertial solution represented by using the FC solution for orientation and the accelerometers for velocity and position, which is a fairly powerful method if the aircraft loses its GNSS position solution. You can also use the rate gyro data directly to solve the full inertial problem, and that works well for short periods until the drift and bias effects spoil the inertial orientation solution. You can further mitigate that with a simple sensor fusion scheme using the magnetometer data to correct the orientation, but that's less trivial to implement and not something that Excel is going to be able to handle - it's really the wrong tool for the job here.
 
Last edited:
You likely may have encountered the classic problem with the Tait-Byran angles that are used to represent pitch, roll and yaw. At a pitch of ± 90°, roll and yaw are equivalent and indeterminate. The condition is also referred to, misleadingly in my opinon, as gimbal lock. Anyway - for that reason you cannot reliably use Tait-Bryan angles to track orientation. Most systems, including DJI, use the quaternion representation, which does not suffer from that problem. Those are explicitly recorded in the DAT files, but are not in the txt logs, and while it is relatively trivial to recover the quaternions from the Tait_Bryan angles, it will fail at those singularities. That said, if you are working with the raw IMU data then obviously you have the DAT files, and can use the quaternions directly.

That's what I implemented to get the partial inertial solution represented by using the FC solution for orientation and the accelerometers for velocity and position, which is a fairly powerful method if the aircraft loses its GNSS position solution. You can also use the rate gyro data directly to solve the full inertial problem, and that works well for short periods until the drift and bias effects spoil the inertial orientation solution. You can further mitigate that with a simple sensor fusion scheme using the magnetometer data to correct the orientation, but that's less trivial to implement and not something that Excel is going to be able to handle - it's really the wrong tool for the job here.
But, the discrepancy is exhibited at -45° pitch - way before the singularity at -90°. I was suspecting that the M2 was slightly rolled and/or yawed as he pitched it up and down.....
 
You likely may have encountered the classic problem with the Tait-Byran angles that are used to represent pitch, roll and yaw. At a pitch of ± 90°, roll and yaw are equivalent and indeterminate. The condition is also referred to, misleadingly in my opinon, as gimbal lock. Anyway - for that reason you cannot reliably use Tait-Bryan angles to track orientation. Most systems, including DJI, use the quaternion representation, which does not suffer from that problem. Those are explicitly recorded in the DAT files, but are not in the txt logs, and while it is relatively trivial to recover the quaternions from the Tait_Bryan angles, it will fail at those singularities. That said, if you are working with the raw IMU data then obviously you have the DAT files, and can use the quaternions directly.

That's what I implemented to get the partial inertial solution represented by using the FC solution for orientation and the accelerometers for velocity and position, which is a fairly powerful method if the aircraft loses its GNSS position solution. You can also use the rate gyro data directly to solve the full inertial problem, and that works well for short periods until the drift and bias effects spoil the inertial orientation solution. You can further mitigate that with a simple sensor fusion scheme using the magnetometer data to correct the orientation, but that's less trivial to implement and not something that Excel is going to be able to handle - it's really the wrong tool for the job here.
Welcome back @sar104 ... long time no see :D Thumbswayup
 
But, the discrepancy is exhibited at -45° pitch - way before the singularity at -90°. I was suspecting that the M2 was slightly rolled and/or yawed as he pitched it up and down.....
Shooting from the hip here: if yaw is orthogonal to roll at 0° pitch, but they're equivalent at ±90° pitch, shouldn't we expect some level of the issue to show up in Tait-Bryan solutions at any non-zero pitch? But that may or may not account for the entirety of what we see in @boblui's data.
 
Interesting. This occurred while the vision system was being used. Can you try this outside so that GPS is being used instead?

Also, can you try the experiment four times - pointed magNorth, magEast, magSouth and magWest.
Here you go.... I have done two directions only because I got tired in fighting against it .

The results are the same but the change in yaw and roll occurred only when the pitch angle was close to -90 deg. I guess that's because I paid extra attention to keeping the yaw and roll unaltered in the process.

1604367840288.png
 

Attachments

  • DJIFlightRecord_2020-11-03_[08-38-29].txt
    124.5 KB · Views: 1
Last edited:
..., if you are working with the raw IMU data then obviously you have the DAT files, and can use the quaternions directly.

As this point I cannot work on quaternions because I haven't learnt about it yet. Euler angles are a lot easier and intuitive for me. Just wondering what the sequence of rotations is in DJI's representation. My assumption is yaw -> pitch -> roll . Is it correct ? Are there any ways to find out ?
 
Last edited:
As this point I cannot work on quaternions because I haven't learnt about it yet. Euler angles are a lot easier and intuitive for me. Just wondering what the sequence of rotations is in DJI's representation. My assumption is yaw -> pitch -> roll . Is it correct ? Are there any ways to find out ?

Correct - the Tait-Bryan representation used in aerospace comprises the intrinsic rotations around the aircraft axes Z, Y and X, in that order. Strictly those angles are referred to as heading, elevation and bank, but colloquially the terms yaw, pitch and roll, which properly refer to incremental rotations about those axes, are used instead.

The only non-standard aspect of the DJI implementation is that pitch ranges from -π to +π and roll from -π/2 to +π/2. Normally it would be the other way around.
 
Correct - the Tait-Bryan representation used in aerospace comprises the intrinsic rotations around the aircraft axes Z, Y and X, in that order. Strictly those angles are referred to as heading, elevation and bank, but colloquially the terms yaw, pitch and roll, which properly refer to incremental rotations about those axes, are used instead.

The only non-standard aspect of the DJI implementation is that pitch ranges from -π to +π and roll from -π/2 to +π/2. Normally it would be the other way around.
I guess this info is being presented in a FOREIGN language!
 
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
130,995
Messages
1,558,715
Members
159,983
Latest member
Glenn-S