11-01-2017 07:06 AM
Hi.
I'm trying to balance a Quad-copter on a single axis using myRIO. Im using the onboard accelerometer for reading the acceleration on the x-axis, but there is a lot of noise which is due to the 4 motors. I have tried a variety of combination of PID gains but the oscillations dont go away. The copter keeps oscillating around the axis. Kindly see the attached VI for more details. What more should I do to stabilize the copter?
11-01-2017 08:48 AM
Hi Sibz,
- when you use an averaging filter you also apply a phase shift. This may hurt your PID…
- have you considered to use a D gain?
- your loop doesn't contain any timing (as far as I can see). I prefer to call the PID at a known interval.
- you might try to use PID gain scheduling for small and larger acceleration values…
On your VI:
- why do you divide by 10, followed by a multiplication with 0.01? Why not just divide by 1000? Why not just use different P gain with a smaller PID output range?
11-01-2017 01:15 PM
Thanks GerdW
Q:
How else can I reduce the noise in Accelerometer readings? Should I use a separate external gyro or accelerometer? If yes then which one would be the best?
A:
- Yes I have tried using the D gain and the motors behave abnormally ( keep changing rpm to either zero or full throttle) which I think is due to the noisy readings from the accelerometer as the motors spin.
- I have tried timing the loops too but the results remained same or worse.
- PID gain scheduling might just be the thing but I think noise in the readings will have an effect on it too. I am going to try it anyway and will share the results.
- The divisions and multiplications are used to increase or decrease the range of thrust by varying the constant 0.01 and 0.05. Here 0.05 is the middle thrust pwm and 0.01 is the most and the least thrust pwm (0.05+0.01=0.06 max thrust pwm OR 0.05 - 0.01= 0.04 min thrust pwm).
It can be done in many other ways.
11-02-2017 02:36 AM - edited 11-02-2017 02:39 AM
Hi Sibz,
Yes I have tried using the D gain and the motors behave abnormally ( keep changing rpm to either zero or full throttle) which I think is due to the noisy readings from the accelerometer as the motors spin.
Maybe the D gain was too large?
I have tried timing the loops too but the results remained same or worse.
At which speed does your loop run right now? Setting an iteration rate of 2-5ms (=500-200Hz) should be ok…
The divisions and multiplications are used to increase or decrease the range of thrust by varying the constant 0.01 and 0.05. Here 0.05 is the middle thrust pwm and 0.01 is the most and the least thrust pwm (0.05+0.01=0.06 max thrust pwm OR 0.05 - 0.01= 0.04 min thrust pwm). It can be done in many other ways.
Yes, but setting the output range of the PID to the allowed range of [0.04, 0.06] is easiest.
You need to adapt your P gain from current "22" down to "0.022" to follow the smaller output range (from ±10 down to ±0.01)…
How else can I reduce the noise in Accelerometer readings? Should I use a separate external gyro or accelerometer?
Adding more sensors will always help, but you need to develop some "sensor fusion" algorithm then.
Right now I would just use an average of a small number of samples (like 4)…
(As the default PID supplied by NI internally resets, when you change the PID gains, I made my own copy from this without this annoying behaviour…)