We have made good progress with wind estimation. It is now incorporated into MatrixPilot. The theory is described here.
With respect to the cross-coupling of the acceleration into pitch estimation during a launch, we have not addressed the issue yet, it is not high up on my list. Paul Bizard did a lot of simulations, and found values of the PI feedback gains that were a reasonable compromise between rejection of gyro drift, and rejection of acceleration on takeoff. I think the time constant is between 10 and 15 seconds.
Beyond that, there are many things you could do, including turning off the PI roll-pitch compensation during high acceleration. There are many people who are using this approach.
One more thing I forgot to mention, I don't recall whether it is mentioned in the "DCM document":
You can approximately adjust the accelerometer value along the axis parallel to the fuselage by computing the forward acceleration from the stream of GPS velocity reports. Although this does not help much during high acceleration launches, it will do a reasonable job once the plane is in flight, because the errors caused by the GPS dynamic behavior as the plane accelerates and decelerates tend to cancel each other out.
"(1) ...I assume that in a normal body axis convention (as in ArdIMU as opposed tp MatrixPilot ie X is +ve forward - this would be the fisrt column - rxx, rxy, rxz)?"
You are correct.
"(2) You mention that the plane must change attitude for this to work - and then refer to the denominator of Equ6. Now Equ6 computes the estimated airspeed, and if the denominator is zero, this cannot be computed. Is this the reason behind your statement?"
" If in fact I have a measure of airspeed - via a pitot - and hence do not need to compute equ6 - can I then be computing regardless of the planes change of (or lacl of chnage) in attitude?"
Thanks for the answers above. I would like to take these questions further, relating specifically to the use of GPS CourseOverGround to determine Yaw Gyro Bias
In the DCM theory document on page 21, you comment that the assumptions made when using GPS CourseOverGround (as opposed to actual Aircraft Heading – the direction in which the aircraft is actually pointing) are violated in the case of strong wind. This I understand.
However, if I am prepared to accept that the value of “yaw” as will be computed from the resulting DCM matrix is in fact a “course over ground” as opposed to an “aircraft heading”, and that the prime purpose here is as accurate a determination of yaw gyro bias as possible, that this is achieved irrespective of wind?
(The advantage of this would be that we would not be contaminating the errorYaw vector with what can only be a best estimate of wind. As this vector gets combined with the errorRollPitch vector to compute the final correction vectors, I assume any inaccuracies in the errorYaw vector will affect all gyro bias values – not only yaw).
Regarding the effect of the wind on yaw gyro drift correction, the wind is relevant only during turns.
If your flight plan involves mostly long straight paths with turns only once in a while, you do not need to account for the wind if you use GPS course over ground to compensate for yaw drift. The controls will rotate the plane the exact amount needed for the wind.
However, unless you somehow measure and account for the wind in the navigation calculations, there will be a temporary yaw error after a turn, that will gradually dissipate.
An example might help. Suppose the plane is flying along at 10 meters/second airspeed with a cross wind of 5 meters/second. It will be crabbing into the wind with an angle of 30 degrees. Then suppose the navigation controls decide to make a 90 degree turn into the wind. In other words, navigation commands a change in course over ground of 90 degrees. It will rotate the plane by 90 degrees. However, all that is needed to turn directly into the wind and to change the course over ground by 90 degrees, is a 60 degree turn measured by the IMU, so with a 90 degree turn, the plane will wind up flying with a 30 degree error in course over ground. That will show up in the GPS course over ground, and the drift compensation algorithm will respond to it, but it will take 10 or 20 seconds to do so. During those 10 or 20 seconds, there will be a difference between the desired and actual course over ground.
So, if your flights will involve frequent turns, it is best to account for the winds in the navigation calculations. You can either estimate the winds using the method I have suggested, or you can use a magnetometer to be able to distinguish between course over ground and the direction the plane is pointing.
You can also simply ignore the wind if you are willing to tolerate temporary course errors.
Actually, cross coupling between the earth and body frames of references reduces the drift of the yaw gyro, without any negative effect on roll and pitch. Tests have proven out the theory of an interesting effect. Consider an extreme case, either as a thought experiment, or as a real test, to see what is going on:
1. Start up your IMU close to being level, without any GPS or magnetometer connected for yaw drift. Program it to perform roll-pitch drift compensation only. During initialization, gyros will be approximately zeroed. After some time, the accelerometers will perfectly lock the roll and pitch. Yaw will slowly drift, at a small residual rate, because there is not any yaw feedback.
2. Rotate the IMU by 90 degrees, either by rolling or pitching, so that the axis of the Z gyro is horizontal instead of vertical.
3. Wait a few minutes. During this period of time, the accelerometer information is zeroing the Z gyro! During the same period, one of the other gyros will not receive any feedback, but it will be close to be perfectly zeroed, so its drift will be low.
4. Rotate the IMU back to level. The Z gyro is now zeroed, although the yaw angle is random.
There is another effect that you might be interested in: the bottom row of the direction cosine matrix is independent of yaw, so any yaw drift does not impact it. The reason for this is that the bottom row represents the earth frame Z axis as seen in the body frame. Because the earth frame Z axis does not contain any yaw information, it appears the same in the body frame, no matter what the yaw angle is. In fact, if you are only interested in roll and pitch, you only need to compute the bottom row of the matrix, which can be computed using only the bottom row information, and all three gyro signals. The fact that the Z gyro may have some drift is irrelevant, it all works out ok.
I think I see what you are missing, but it is going to take some thought on my part to figure out a way to explain it.
In the meantime, here is another data point for you:
There is a roll-pitch-yaw demo program available along with MatrixPilot. I use it routinely for testing purposes. I run it without any sort of yaw compensation, I set the yaw error to zero. The bottom row of the matrix perfectly tracks roll and pitch, no matter what is going on with yaw. The other elements are more or less ok, except there is a slow yaw drift.
I will see if I can think of another way to explain why things work out so well. In the meantime, here are some factors that may be involved in explaining the discrepancy, perhaps you will be able to explain it:
1. MatrixPilot and the roll-pitch-yaw demo software record the gyro offsets during power up, so once the DCM algorithm gets running, the residual drifts are rather small.
2. If the board is level, yaw drift has no impact on roll and pitch. In other words, if roll and pitch are zero and roll and pitch rate are zero, there is no way for yaw to change roll and pitch.
3. If the board is not level, there is enough information from the accelerometers to compensate for yaw drift, so there will be yaw lock.
4. If GPS is available to achieve a strong yaw lock, there may be a phase angle error in yaw, but the yaw rate error will be zero.
5. It is true that all three gyros are involved in computing the bottom row of the matrix. However, there are linear combinations of drifts that will not impact roll and pitch.
I think what may be going on in your simulations is that possibly you are not including the effect of roll-pitch compensation and/or you are introducing arbitrary yaw gyro errors?
As long as the yaw gyro error is a small offset (a few degrees per minute), everything should work out ok.
I have run out of room in this message, I will send you another later.
Perhaps the amount of Z gyro offset that you were using was too large. That will result in numerical errors due to neglect of second order terms, followed by an effect I call "coning" that is caused by in interaction of the second order terms with normalization, followed by a failure to achieve roll-pitch lock.
Otherwise, the theory says that yaw compensation is orthogonal to roll-pitch compensation, as long as roll-pitch lock has been achieved. Here is why:
The roll-pitch rotation error vector is computed by taking the cross product of the last row of the matrix, with the gravity vector measured by the accelerometers. Since gravity is vertical in the earth frame, the computed roll-pitch error vector is in the horizontal plane of the earth frame.
The yaw rotation error vector is computed by taking the cross product of two vectors that are both in the horizontal plane of the earth frame. The result is parallel to the earth frame vertical.
Therefore, the yaw rotation error vector and the roll-pitch rotation error vector are orthogonal in the earth frame. Therefore they are orthogonal in the body frame. Therefore, an error in the yaw compensation does not impact the accuracy of the roll-pitch compensation.
Another thought...in case you have not seen them, you might be interested in Robert Mahony's papers. He goes into more mathematical detail.
The point I was trying to make in my previous comment is that:
1. When the IMU is not level, the drift compensations compute rotation corrections that are applied to all three physical gyros, because each gyro receives a weighted sum of the three elements in each rotation error vector.
2. When roll-pitch lock has been achieved, the roll-pitch rotation compensation error vector is orthogonal to the yaw rotation compensation error vector, in any frame of reference. So, when the two rotation error vectors are transformed from the earth frame into the body frame and mapped onto the physical gyros, they should not interfere with each other.
I think I understand your question, which I think boils down to, "Do errors in the yaw rate gyro create errors in roll-pitch values". If that is the question, my answer is that, provided the rate errors are not so large as to break lock, the roll-pitch values should not be impacted by yaw error.
Actually, the problem could be related to gyro offsets. How much gyro offset are you assuming? Too much yaw gyro offset could "break" the roll-pitch lock when you roll or pitch the board, if there is no source of yaw lock. This has been demonstrated both theoretically, and with the demo. In other words, the PI feedback controller can handle only so much gyro offset before the DCM elements go into a "spin". (If there is a source of yaw lock, there should not be any problem.) Here is what happens in a particular scenario with a large yaw offset, without any yaw reference.
1. Board is level. Roll and pitch are zero. Yaw gyro has an offset.
2. Roll (or pitch) the board slightly. The computed earth axis will slowly wobble, because of the offset in the physical yaw gyro.
3. The wobble will produce roll and pitch errors, which will be detected by the roll-pitch feedback controller. In other words, there will be a roll-pitch error vector detected in the earth frame of reference. When it is projected back into the body frame, a portion of it will be applied to the yaw gyro in the body frame.
4. Depending on the PI gains and the amount of the offset, the PI controller may or may not be able to stop the wobble.
What we have found is that, with an offset of a few degrees per minute, you can achieve roll-pitch lock.
More thoughts regarding the subject in my previous message....
If there is any sort of yaw reference, it should reduce the residual yaw gyro offset to zero, and the problem I alluded to should go away.
There is another problem that I ran into, which I classify as a software bug, that arises if the GPS is intermittent. What can happen in that case if you are not careful is that you could wind up "freezing" the yaw error computed froml the last GPS message received. If you then apply that error to the PI controller, the integrator will ramp up to infinity, causing all sorts of problems.
At this point, I declare that you are the expert on this topic. I wish I had more time to dig into the questions that you are asking. They are good questions, but I think it will take more time than I can afford right now to give you good answers. Perhaps when flying season is over here where I live, I will go back and take a look.
I am going to send a note to Paul Bizard, who did a lot of simulations that explored the very questions that you are asking. Perhaps he can shed some light.
We are a couple of regular Johannesburg based Pro pilots (one retired) who are interested in the DIY UAV scene. Do you supply kits at all?
We are aware of the paranoia our local CAA has about drones. Is there a small, light, inexpensive transponder available for home made UAVs?
We are interested in developing a small fast, long range uav , perhaps with an inexpensive ardu autopilot, for both photographic purposes, and also to deliver snake bite serum directly to remote bush locations. Perhaps game lodges etc. The idea being that the serum and appropriate syringe and instructions could be air dropped at a gps location, or the whole uav could be parachuted into the drop zone. The machine would have to be very affordable,
We would greatly appreciate your ideas. Congratulations on your expertise and achievements.
Joe, Thanks for responding to my request. I posted a message in the forums under aerial photography asking some advice based on my needs in the future. After reading many of your comments, I felt that you could give me some basic information. Specifically, what type of vehicle would suit my needs the best right now. Please review my post with more specifics and let me know what you thinks. Again, thanks for all the information that you provide individuals!