I wanted to start a conversation around the roll and pitch of Arducopter drifting as you fly.
The reason is I just assembled new hardware and problems that weren't there before have now shown up in a bad way. Flying indoors in a 5ft space I was able to get up to 30° error in roll and around 10-15° in pitch. I was able to control it and it flew perfectly level the whole time, I just had to hold the stick into the corner of the radio. Lading and waiting corrects the issue.
What could cause this. I had been flying an older version of the IMU this whole time. This version has an analogue filter for the gyros where the new hardware has it as an option. You must solder the pads around the gyros to enable them. I was also flying with two slightly tweaked motors giving off a lot of vibration. This could affect the accels.
My question is: If you have a problem like this, what is the vibration level on your copter, and do you have the filter pads soldered?
And notice I didn't say "loss of control" or "it didn't fly stable". I had control, and it flew perfectly. It just lost it's reference to the ground and I had to compensate with the stick. Had it been worse than 45° I would have lost control.
There are three pairs of pads, each with a white outline. (look for GYRO-XY near the relay).
Jani Solders his to enable the filter. I have never flown this board until now. I will solder them to test the filters this week.
Replies are closed for this discussion.
Would be interesting to make this test with dynamically balanced motors like AXI Gold range.
Those strong vibrations seems like resonnance. They should be quite easy to suppress, adding an impendance change in the arms (elastic join).
If actual sampling is done at 200 Hz, all noise higher than 90 Hz needs to be filtered or it will go back in the 0 - 100 Hz spectrum by aliasing.
Analog filtering is certainly mandatory, but eventually, there could be a problem with the gyro himself, if it does have a modal frequency where he can resonnate.
In this case, the best is to supress the mechanical vibrations.
It could be usefull to test the Gyro analog outputs with a spectrum analyser (or digital scope with FFT), to see the true noise spectrum.
The pretty cool gifs sparked my curiosity regarding the filters that are placed between the gryo outputs and the a/d inputs. Quick inspection shows them to be the usual single pole RC filter, the cutoff frequency (-3db point of the response) is of course fc=1/(2*PI*R*C). The gyro output impedance is stated as 200 ohm in the manufacturers datasheet. The output impedance is effectively in series with the filters resistors (R1, R3 and R6) yielding a total series resistance of about 950 ohms. The capacitance to ground is 0.1uF. Substituting these values shows the cutoff frequency of the filter network to be approximately 1675Hz. This cutoff frequency could probably be lowered to some value that would permit more significant filtering of the observed system noise without impacting operational performance.
1st order low pass filters completely pass their spectrum unchanged from 0Hz to about 1/10 the cutoff frequency. If we would like to allow rates of change of 500 degrees per second to pass through the filter unchanged, this would correspond to a 0.1fc frequency of about 1.39Hz, with a cutoff frequency 10 times this or 13.9Hz. Spinning the gyro a 1.39 revolutions per second would be read by the a/d converter as though this filter was not there. Spinning the gryo at 13.9hz would be read by the gyro at half of its actual rate..filtering has begun to be effective at this point (note 13.9hz represents rates of change of rotational rate of 5000 deg/second..a rate high enough that we probably wouldn't be interested in, in the real world). Low pass filters continue to decrease their output as the frequency increases at a rate of -20db/decade, meaning 1/10th the voltage passes for a 10 times frequency increase. The first order filter with a cutoff frequency of 14 hz would have its output at 1/10th amplitude in response to gryo signals at 140Hz, furthermore, the output would be 1/100th (-40db) at 1400hz. This represents a significant descrease in noise that has been induced into the frame by the motors in this frequency band.
A 14 Hz, 1st order filter, could be tried with an 11 KOhm resistor substituted for R1, R3 and R6, and a 1uF ceramic capacitor substituted for C1, C2 and C25.
I am just a community member and am not suggesting or encouraging anyone to ruin their board, voiding their warranty, or causing any other kind of controversy. But if someone, very skilled in the process of component substitution could try it and report on their results....
Jason, could you mod up a board as described above:
"A 14 Hz, 1st order filter, could be tried with an 11 KOhm resistor substituted for R1, R3 and R6, and a 1uF ceramic capacitor substituted for C1, C2 and C25."
and test the effect? Is seems a pretty sound analysis (though I would probably even go lower with the cutoff frequency, say 8 Hz, and allow the filter to start having a slight effect by 500 degrees/sec)
Excellent and clear description Michael. The 800Hz noise reported by Kári will be reduced by about 35 dB which will give a significant improvement to that aliasing problem. 40dB if you use my 8Hz cutoff suggestion.
Incidentally, suitable values for 8Hz are:
18 KOhm resistor substituted for R1, R3 and R6, and a 1uF ceramic capacitor substituted for C1, C2 and C25. These are preferred resistor/capacitor values and yield 8.7 Hz.
Sounds neat, but I have no idea how to do that....
Maybe something Jordi could try?
Such a low corner frequency will introduce phases modifications in the signal.
A 10° to 45° phase shift will be observed for frequencies between 0.1 and 1 corner Frequency.
If using a 8 Hz corner frequency, this mean that 10° phase error will be seen at 0.8 Hz, and 45° at 8 Hz.
Trying a 25 Hz corner frequency could be interesting as well, to limit phase errors.
Last, i think that a first order is not the right solution. As i said previously it should be better to have at least a 3rd order filter, or a 5th order filter.
I would choose a 3rd or 5th order filter with a 70-80 Hz corner frequency.
This would allow to keep the gyro responsiveness without introducing phase shift inside the usable spectrum.
Here is the phase shift of a first order filter :
does the phase shift matter in this application? All we need from the gyro is a rotation estimate. The advantage of using a first order is we can test it now with existing hardware and get <some> immediate benefit. I agree the next rev of IMU should do something more sophisticated and a better filter is required.
JDM45 has valid points..phase shift matters because of the feedback nature of a control system. The speed at which disturbances can be detected and reacted to is the system bandwidth, but the overall phase and delays and noise in the system limits the maximum rate the controller can provide feedback compensation and provide stability and steadiness. The invensense gyros already have a 1st order filter built inside with a cutoff frequency of 140Hz, which induces about 6 degrees of phase shift in the response at 14Hz. Lowering the cutoff frequency to 14Hz using the RC values above will indeed introduce another 45 degrees for a total phase shift of about 50 or so degree. This delay corresponds to a measurement delay of about 10 milliseconds for the higher rates of change of angular velocity at 14Hz, at 400hz a/d sampling followed by a 4 sample averaging filter (which is what I believe the code is doing), this would yield a gyro output 1 effective output sample late, and 2 output samples late at 140Hz. The phase delay up to 0.1fc or 1.4Hz, corresponding to what should be the maximum rate of angular acceleration that I have assumed, the sampling delay should be unnoticeable. What matters is that the rest of the system is "slow" enough to not notice this, if the moments of inertia of the frame/motors yield a mechanical frequency response that is relatively similar it could work, if its a much faster mechanical system then it won't. Tuning and testing the RC network iteratively is the only way to know for sure.
Michael, JM, The quickest way to progress this is to raise it as an Issue. The dev team monitors the issues, and I think this one's pretty important. Michael, would you like to raise an Issue, requesting that one of the hardware guys mods up an IMU with your best guess 1st shot values for better lowpass filters and perhaps sends it to you for testing (is that the best way?) If you're not comfortable raising an issue for any reason, I'm happy to do it and I'll defer to your (Michael, JM) preferred selection of initial breakpoint.