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

what type of data is the GPS module feeding the mavic? I have an idea

@sar104 not sure I agree with your 'conflicting signals' hypothesis above. I'm thinking the IMU's principle function is maintaining aircraft stability e.g. not allowing pitch/roll/yaw movements beyond limits ... the aircraft knows what pitch/roll/yaw it is at and how fast that pitch/roll/yaw is changing (accelerometer triad, angular momentum triad) and when limits are reached, the prop pitch is 'dialed back' accordingly, which is why you can't roll or invert a Mavic. I guess it could also be used for micro adjustments to counter wind gusts, pressure drops etc. I'm really not sure it has anything to say about position or heading, computed or otherwise . Now the compass, yes definitely, as you say GPS only informs where you are, not your heading (except when moving, as you say). I would argue loosing either compass lock or GPS lock would warrant ATTI mode, and my hypothesis is that the IMU has no part to play in it.

Sorry but your hypothesis is wrong. SaR is spot on.
 
thanks for doing that ! I don't have a data analyzer to check things out on a trackimo :( but the info you posted will help and is good to know :) heck it may help with some ideas from other people too! :)

You're welcome. I enjoy taking things apart, and even more when they still work after putting them back together! ;)
 
You're welcome. I enjoy taking things apart, and even more when they still work after putting them back together! ;)

lol I know what ya mean there! lol
 
if ya ever get another "good day" it would be interesting to see what data does the compass puts out :)
 
if ya ever get another "good day" it would be interesting to see what data does the compass puts out :)

Interestingly, I've just watched a 'tear-down' video on YouTube and the chap mentions that the compass is actually in the same compartment as the GPS module. If this is correct, then you already have compass data in the trace files linked above! I guess it does make sense having two completely different signals i.e. one for GPS, the other for compass.

(
)
 
i am thinking it has two completely different signals
 
@sar104 not sure I agree with your 'conflicting signals' hypothesis above. I'm thinking the IMU's principle function is maintaining aircraft stability e.g. not allowing pitch/roll/yaw movements beyond limits ... the aircraft knows what pitch/roll/yaw it is at and how fast that pitch/roll/yaw is changing (accelerometer triad, angular momentum triad) and when limits are reached, the prop pitch is 'dialed back' accordingly, which is why you can't roll or invert a Mavic. I guess it could also be used for micro adjustments to counter wind gusts, pressure drops etc. I'm really not sure it has anything to say about position or heading, computed or otherwise . Now the compass, yes definitely, as you say GPS only informs where you are, not your heading (except when moving, as you say). I would argue loosing either compass lock or GPS lock would warrant ATTI mode, and my hypothesis is that the IMU has no part to play in it.

I maybe didn’t make my point clearly. What I stated is not a hypothesis - it is how sensor-fusion flight control works - there is no mystery about that and there are multiple papers published on the subject. Furthermore you can trivially examine the flight data and event log to see these sequences happening.

Losing GPS lock obviously results in ATTI mode. There is no such thing as “losing compass lock” unless the compass(es) becomes disconnected or broken, but incorrect compass data, either due to calibration issues, magnetic distortion on startup (most common issue) or encountering magnetic distortion in flight, will cause problems. If you consider how the FC computes yaw then the mechanism of that problem is quite simple:

On startup, the FC knows position from GPS and yaw from the compass data, and it initializes those values in the IMU. Thereafter, when it takes off and moves, its primary calculation of pitch, roll, yaw, velocity and position are computed from the high-speed accelerometers and rates gyros, with the compass heading and low-rate (5 Hz) GPS position and velocity data used as low-gain adjustments to correct for rate gyro and accelerometer bias and drift. If the resulting computed yaw and compass heading diverge, rather than converge, then the sensor fusion scheme has failed and the FC declares an IMU exception. It now does not trust its yaw value, and therefore cannot control its position in the earth frame of reference - that is the most common cause of it abandoning positional control, a.k.a GPS mode.
 
Oh, and to the OP's point, I'll best DJI simply purchased a cots GPS module, which would invariably output a UART lat/long at 5 or so hertz. If I could be bothered, I could test this hypothesis as I have both a Mavic and a digital signal analyser!

That’s correct. It’s the standard 5 Hz GPS data stream.
 
There is no such thing as “losing compass lock”

Agreed. Poor choice of words on my part.

On startup, the FC knows position from GPS and yaw from the compass data, and it initializes those values in the IMU. Thereafter, when it takes off and moves, its primary calculation of pitch, roll, yaw, velocity and position are computed from the high-speed accelerometers and rates gyros, with the compass heading and low-rate (5 Hz) GPS position and velocity data used as low-gain adjustments to correct for rate gyro and accelerometer bias and drift.

Mostly agreed but I'm not quite convinced about "position" ... pitch, roll, yaw, velocity, yes, absolutely agree and ...

If the resulting computed yaw and compass heading diverge, rather than converge, then the sensor fusion scheme has failed and the FC declares an IMU exception.

... totally agree with this too (although to split hairs, I wouldn't consider the compass(es) to be part of the IMU; there's nothing 'inertial' about measuring a (largely) static magnetic field.)

But I remain unsure about "position". If your argument is to be accepted, i.e. the "primary calculation" of position is via the IMU and corrected by GPS, then why do drones drift proportionally to wind velocity in ATTI mode? If positional control was principally calculated through the IMU then, whilst I appreciate sensor inaccuracies may play their part, I would imagine that the aircraft would still correct for wind as best it can. In my experience (only once, thankfully!) the aircraft stays perfectly orientated (i.e. pitch, roll, yaw) in ATTI mode but drifts wildly with the prevailing wind.

Given the argument presented, it remains my hypothesis that positional control (i.e. with respect to the earth) is achieved via GPS positioning alone and not via the IMU. The natural progression being that the IMU is only used as an input to the FC to limit control input and maintain aircraft stability.

I'm probably wrong, you sound like a super smart guy but, hey, I've presented a hypothesis and supported it with test evidence.
 
Agreed. Poor choice of words on my part.



Mostly agreed but I'm not quite convinced about "position" ... pitch, roll, yaw, velocity, yes, absolutely agree and ...



... totally agree with this too (although to split hairs, I wouldn't consider the compass(es) to be part of the IMU; there's nothing 'inertial' about measuring a (largely) static magnetic field.)

But I remain unsure about "position". If your argument is to be accepted, i.e. the "primary calculation" of position is via the IMU and corrected by GPS, then why do drones drift proportionally to wind velocity in ATTI mode? If positional control was principally calculated through the IMU then, whilst I appreciate sensor inaccuracies may play their part, I would imagine that the aircraft would still correct for wind as best it can. In my experience (only once, thankfully!) the aircraft stays perfectly orientated (i.e. pitch, roll, yaw) in ATTI mode but drifts wildly with the prevailing wind.

Given the argument presented, it remains my hypothesis that positional control (i.e. with respect to the earth) is achieved via GPS positioning alone and not via the IMU. The natural progression being that the IMU is only used as an input to the FC to limit control input and maintain aircraft stability.

I'm probably wrong, you sound like a super smart guy but, hey, I've presented a hypothesis and supported it with test evidence.

It drifts in ATTI mode because it doesn't attempt to correct for drift. The reason for that is as I explained above. The IMU does continue to compute position in ATTI mode - it's recorded in the log files - and it continues to compute yaw, both from the rate gyros and the compass but, since IMU yaw and magnetic yaw disagree, it doesn't know which way it is pointing and so it wouldn't know which way to push to correct for the drift. So, in ATTI mode, it uses the rate gyro and accelerometer data to hold level and not spin, combined with the barometer data to hold altitude. That results in no net lateral propulsion at it will asymptote to zero airspeed and move with the local wind speed relative to the ground.

As I said - that's not speculation - it's how sensor fusion works. Are you saying that you have test data that contradicts that? You argued that positional control is achieved just by GPS but I didn't see any evidence to support that. And if you don't accept the published literature on how sensor fusion works and want further easily obtainable direct evidence that shows that this is not the case, look at the computed location data in the DAT files - it is updated at 200 Hz - the same as the IMU sensor data, not 5 Hz, which is the GPS data rate.
 
A compelling argument.

Btw, the 'evidence' I was referring to was my experience in ATTI mode where, despite the FC undoubtedly being aware that it is being laterally 'pushed', makes no attempt to correct its position.
 
  • Like
Reactions: sar104
A compelling argument.

Btw, the 'evidence' I was referring to was my experience in ATTI mode where, despite the FC undoubtedly being aware that it is being laterally 'pushed', makes no attempt to correct its position.

Ok - I wondered if that was what you meant. Yes - it knows it is moving both from IMU data and direct from GPS data, but it doesn't know how to fix that and doesn't try - the definition of ATTI mode.
 
I'll just add a couple of points. Here is a plot of 1) Longitude computed by the FC, red curve, 200 Hz and 2) Long(1) which comes from the GPS module, blue curve, 5 Hz.
upload_2018-3-6_7-32-9.png

The FC presents it's confidence in the computed coords as the signal gpsHealth which has the range 0 (no confidence) to 5 (best). About a year ago there were many incidents involving an abrupt decrease in gpsHealth - seemed like 2 or 3 a day. It wasn't known back then what gpsHealth was or that the coords seen in the IMU record were actually computed from GPS data and IMU data. When it was figured out about 2 months ago it then made sense why 1) DJI's standard response to a gpsHealth issue was to calibrate the compass, 2) gpsHealth can drop to 0 even when there are plenty of satellites, and 3) gpsHealth would often drop after something that might confuse the FC like an abrupt attitude change.
 
  • Like
Reactions: sar104
I'll just add a couple of points. Here is a plot of 1) Longitude computed by the FC, red curve, 200 Hz and 2) Long(1) which comes from the GPS module, blue curve, 5 Hz.
View attachment 32902

The FC presents it's confidence in the computed coords as the signal gpsHealth which has the range 0 (no confidence) to 5 (best). About a year ago there were many incidents involving an abrupt decrease in gpsHealth - seemed like 2 or 3 a day. It wasn't known back then what gpsHealth was or that the coords seen in the IMU record were actually computed from GPS data and IMU data. When it was figured out about 2 months ago it then made sense why 1) DJI's standard response to a gpsHealth issue was to calibrate the compass, 2) gpsHealth can drop to 0 even when there are plenty of satellites, and 3) gpsHealth would often drop after something that might confuse the FC like an abrupt attitude change.

hum that makes sense it sure seems when there is a flyaway, some type of "abrupt attitude change" has taken place! I guess there has to be some way to "improve/fix it" so its more stable.
 
hum that makes sense it sure seems when there is a flyaway, some type of "abrupt attitude change" has taken place! I guess there has to be some way to "improve/fix it" so its more stable.
Almost all of the fly aways that I'm familiar with were caused by a geomagnetically distorted launch site. This will often lead to a compass error and, possibly, erratic flight but not abrupt attitude changes. The gpsHealth dropping to 1 or 0 scenario usually results in a switch to ATTI mode followed by a drift away (with the wind) and not a fly away.

I suspect there is a trade-off between false positives and missing those situations where gprHealth really should be low. It does seem like the gpsHealth dropping for no apparent reason scenario has gotten much better since that period a year ago when that happened a lot.
 
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

Members online

Forum statistics

Threads
131,089
Messages
1,559,732
Members
160,074
Latest member
SkyTechDji