P4P 2.0 slow drifting in hover

Joined
May 14, 2018
Messages
91
Reaction score
21
Age
53
@BudWalker or other wizards of drone logs,

I was wondering if you could take a quick look at the following and tell me why my new P4P 2.0 is slowly drifting in hover. Depending on which way I turn leading into the hover, it will start to slowly rotate on its own and may go clockwise or may go counterclockwise. It will also eventually stop turning if I let it sit long enough. I made sure to be in a large field away from anything for this flight.

Looking at the logs with my limited knowledge I see that the yaw and mag-yaw are sometimes drifting apart or back together which seems to correspond to what I am seeing.

I found a similar issue with the Mavic Air that DJI claims will be fixed with firmware soon. Is it possible that the new P4P 2.0 is using similar code or hardware that makes it have this same issue?

2018-06-16_08-41-35_FLY008.DAT
 
@BudWalker or other wizards of drone logs,

I was wondering if you could take a quick look at the following and tell me why my new P4P 2.0 is slowly drifting in hover. Depending on which way I turn leading into the hover, it will start to slowly rotate on its own and may go clockwise or may go counterclockwise. It will also eventually stop turning if I let it sit long enough. I made sure to be in a large field away from anything for this flight.

Looking at the logs with my limited knowledge I see that the yaw and mag-yaw are sometimes drifting apart or back together which seems to correspond to what I am seeing.

I found a similar issue with the Mavic Air that DJI claims will be fixed with firmware soon. Is it possible that the new P4P 2.0 is using similar code or hardware that makes it have this same issue?

2018-06-16_08-41-35_FLY008.DAT
Looks to me like the compass may not be calibrated properly. Have you recently added some external device like a tracker? Before you calibrate can you do a test? Turn the battery on but don't start the motors. Hold the P4P at arms length and then you rotate 3 or 4 turns while standing in place. Try to keep the P4P level. About 10 secs per rotation. Then provide the .DAT for that "flight".

Do the same test after calibrating.

Here's why I suspect a bad calibration. When the P4P comes to rest in the interval [-40°, -80°] the correction required is a CW rotation. Outside this interval a CCW rotation is required.
upload_2018-6-16_7-32-29.png


We should know more after you do your tests.
 
Last edited:
Thanks, I will perform the test and get back to you! Nothing added, this is a brand new drone out of the box with about 6 batteries ran thru it so far.
 
Thanks, I will perform the test and get back to you! Nothing added, this is a brand new drone out of the box with about 6 batteries ran thru it so far.
Did you calibrate the compass before you flew it?
 
Did you calibrate the compass before you flew it?

All the flights prior to this one no, I took it out of box and flew but noticed the slow rotating.

I then took it to a large football field and calibrated it just prior to this flight I posted. I made sure no metal was on me, no phone, no watch, the controller and tablet were 30 yards away. This field has no irrigation system.
 
All the flights prior to this one no, I took it out of box and flew but noticed the slow rotating.

I then took it to a large football field and calibrated it just prior to this flight I posted. I made sure no metal was on me, no phone, no watch, the controller and tablet were 30 yards away. This field has no irrigation system.
Well, then the compass is probably calibrated. It's almost impossible to obtain a flawed calibration. Sometimes DJI drones arrive needing a compass calibration but the calibration you performed didn't make any difference.

Please do the test I described. No need to calibrate afterwards. And, please provide the .DAT containing the calibration.

Another way to look at the data is that the Z gyro scale is incorrect. Don't know that if that makes sense. Have you done an IMU calibration?

I'm thinking that @sar104 needs to take a look here.
 
I have not done an IMU cal.

Be aware this is a P4P 2.0 so there may be hardware or firmware differences vs the original models.
 
I have not done an IMU cal.

Be aware this is a P4P 2.0 so there may be hardware or firmware differences vs the original models.
Then could you do the test, then an IMU cal, then another test. But, at the beginning of each test let the AC sit on the ground undisturbed for about 30 secs. This will allow us to see if the effects of the IMU cal, if any.
 
Then could you do the test, then an IMU cal, then another test. But, at the beginning of each test let the AC sit on the ground undisturbed for about 30 secs. This will allow us to see if the effects of the IMU cal, if any.

Will do and thank you very much for all the help!
 
Well, then the compass is probably calibrated. It's almost impossible to obtain a flawed calibration. Sometimes DJI drones arrive needing a compass calibration but the calibration you performed didn't make any difference.

Please do the test I described. No need to calibrate afterwards. And, please provide the .DAT containing the calibration.

Another way to look at the data is that the Z gyro scale is incorrect. Don't know that if that makes sense. Have you done an IMU calibration?

I'm thinking that @sar104 needs to take a look here.

I think there is a compass problem, which may or may not be the root cause of the behavior. The IMU is using compass #1 (Mag0). Looking at the unwrapped values of the IMU yaw, Mag0 and Mag1 shows an obvious periodic discrepancy in the mag values:

2018-06-16_08-41-35_FLY008_01.png


Hard to discern the pattern there, but plotting Mag1 - Mag0 against unwrapped yaw reveals the periodicity:

2018-06-16_08-41-35_FLY008_02.png


A scatter plot of the same quantity against wrapped yaw shows the likely reason for the different behavior that you noted between - 40° and - 80°, which turns out to be the maximum in Mag1 - Mag0:

2018-06-16_08-41-35_FLY008_03.png


Mag1 against Mag0 shows the same deviation in a different way:

2018-06-16_08-41-35_FLY008_04.png


Comparing mag mod values for the two compasses:

2018-06-16_08-41-35_FLY008_05.png


The obvious periodicity in Mag0 suggests to me that compass 1 (Mag0) has the problem (or more of a problem) than compass 2 (Mag1).
 
Guys, I have been communicating with a USA based DJI support manager/employee and he told me that this issue is related to basically the same behavior that the Mavic Air has been demonstrating. He said that the issue affects several of the DJI models including the M210RTK. He referred to it as being a problem with IMU and Compass Biasing and how well they match. A firmware based fix is in progress according to him that has been working well in testing.

I am headed out now to do the test just to give you the data you wanted @BudWalker just in case you see something out of place that I might be able to fix on my own. I love learning about the inner workings of these craft!
 
@BudWalker

Here is the dat file from the compass calibration just prior to this morning's subject flight:
2018-06-16_08-39-35_FLY007.DAT

Here is the dat file from this morning's subject flight (same link as original post):
2018-06-16_08-41-35_FLY008.DAT

Here is a screen shot of me checking the area for the testing out with a gauss meter. This was a slow 360° turn of the subject area:
IMG_2614 (1).PNG


Here is the dat file from sitting the drone down on a level surface and letting it sit there:
2018-06-16_14-04-26_FLY009.DAT

Here is the dat file of the 4 slow turns while holding the drone out at arms length:
2018-06-16_14-06-24_FLY010.DAT

Here is the dat file of the IMU calibration:
2018-06-16_14-34-59_FLY011.DAT

Here is the dat file of the reboot after the IMU calibration:
2018-06-16_14-38-21_FLY012.DAT

Here is the dat file of the drone sitting outside on a level surface after the IMU calibration:
2018-06-16_14-39-52_FLY013.DAT

Here is the dat file of the 4 slow turns while holding the drone at arms length after the IMU cal.
2018-06-16_15-10-49_FLY014.DAT
 
Last edited:
I think there is a compass problem, which may or may not be the root cause of the behavior. The IMU is using compass #1 (Mag0). Looking at the unwrapped values of the IMU yaw, Mag0 and Mag1 shows an obvious periodic discrepancy in the mag values:

View attachment 100178

Hard to discern the pattern there, but plotting Mag1 - Mag0 against unwrapped yaw reveals the periodicity:

View attachment 100179

A scatter plot of the same quantity against wrapped yaw shows the likely reason for the different behavior that you noted between - 40° and - 80°, which turns out to be the maximum in Mag1 - Mag0:

View attachment 100180

Mag1 against Mag0 shows the same deviation in a different way:

View attachment 100181

Comparing mag mod values for the two compasses:

View attachment 100183

The obvious periodicity in Mag0 suggests to me that compass 1 (Mag0) has the problem (or more of a problem) than compass 2 (Mag1).
I think I see what you're saying. Except why is it just Mag0 with a problem. It kinda looks to me like Mag1 also has the same problem roughly 180° phase difference with Mag0. This from FLY014 where @brantel rotated the AC about the Z axis 4 times.
upload_2018-6-16_13-51-1.png

Looking at Mag0 - Mag1 hides the fact that Mag1 also shows periodic behavior since the two extrema coincide but they are 180° out of phase.

Anyway, I don't know what all this means. It's just weird. I was supposing that the gain on gyroZ is too low causing Yaw to always lag behind when the AC is rotated. That's why I suggested considering an IMU calc which didn't make any difference. Just a shot in the dark really since I don't see how an IMU cal can detect and fix a low gain problem.

Maybe DJI's explanation "being a problem with IMU and Compass Biasing and how well they match" relayed to @brantel is right. I just wish I understood what they are talking about.:)
 
I think I see what you're saying. Except why is it just Mag0 with a problem. It kinda looks to me like Mag1 also has the same problem roughly 180° phase difference with Mag0. This from FLY014 where @brantel rotated the AC about the Z axis 4 times.
View attachment 100196
Looking at Mag0 - Mag1 hides the fact that Mag1 also shows periodic behavior since the two extrema coincide but they are 180° out of phase.

Anyway, I don't know what all this means. It's just weird. I was supposing that the gain on gyroZ is too low causing Yaw to always lag behind when the AC is rotated. That's why I suggested considering an IMU calc which didn't make any difference. Just a shot in the dark really since I don't see how an IMU cal can detect and fix a low gain problem.

Maybe DJI's explanation "being a problem with IMU and Compass Biasing and how well they match" relayed to @brantel is right. I just wish I understood what they are talking about.:)

My suspicion that Mag0 is worse than Mag1 is due to the large variation in Mag0_mod with yaw. If you compare Mag0 and Mag1 individually with yaw then they do both show periodic offsets approximately 180° out of phase:

2018-06-16_08-41-35_FLY008_06.png


2018-06-16_08-41-35_FLY008_07.png


However, since the IMU is using Mag0, yaw is primarily informed by Mag0 and so is not an absolute baseline. As a result, even if Mag1 were exactly correct it would appear to have a variation with precisely that phase relationship with Mag0. That is certainly not definitive proof that Mag0 is bad and Mag1 is good and they could both be bad, but both cannot be good. It also doesn't rule out other IMU issues on top of the compass issues.
 
  • Like
Reactions: BudWalker
If this drone is bad, that is 3 out of 3 Phantom 4 Pro 2.0 drones that were bad out of the box. The first two had constant warnings about the compass redundancy switch, primary compass failed switch to atti mode if the drone misbehaves and the compass sensor status page constantly said the compasses were installed backwards and would not display any numbers.

This third drone does not have those issues but does have this issue which the USA based DJI guy says is a known problem that will be fixed with firmware soon. The Mavic Air has a confirmed issue that is almost the same with the exception of the dual compasses.

I have no idea what is true but 3 out of 3 bad out of the box seems like some really poor quality control or they were in too big a hurry to push these out the door and the firmware needs some work.

Question for you wizards, why do the DAT files not have 2 IMU data sets since there are 2 of them? The Mavic Air Dat files have 2 of them but as expected only one compass.
 
Last edited:
....
Question for you wizards, why does the DAT files not have 2 IMU data sets since there are 2 of them? The Mavic Air Dat files have 2 of them but as expected only one compass.
Sure about that? You're right the .DAT doesn't have the record types associated with the second, or third, IMU.

Per @sar104 's analysis, that Mag0 has a problem, you could try this. Move a screwdriver close to Mag0 and the P4P should switch to Mag1. (You'll be able to see this happen by looking at the Go App). Then try a flight and see if you get the Yaw drift behavior
 
  • Like
Reactions: brantel
Sure about that? You're right the .DAT doesn't have the record types associated with the second, or third, IMU.

Per @sar104 's analysis, that Mag0 has a problem, you could try this. Move a screwdriver close to Mag0 and the P4P should switch to Mag1. (You'll be able to see this happen by looking at the Go App). Then try a flight and see if you get the Yaw drift behavior

Here is the Mavic Air Dat file options to pick:
imu.png
 
I know the Mavic Air has 2 IMUs. But, your .DATs have records for just 1 IMU.

Sorry for the thread drift. And thanks for the patience with me!

I get what your saying now, the P4P 2.0 does not have records, the MA does. Got it. Weird DJI does that.

Back to the thread, I tried to trick the drone into switching to the compass 1 and it did but would switch back as soon as the screwdriver was removed. I was afraid of screwing up the compass so I did not try to fly it with something taped to the leg.
 

Recent Posts

Members online

No members online now.

Forum statistics

Threads
143,094
Messages
1,467,600
Members
104,980
Latest member
ozmtl