shikra wrote:After a bit of testing, I really do like this option
This would be my final suggestion...
Use currently unused "level D value" on the GUI /LCD setups to control the max rotational speed in returning to level .....
replace
PTerm = (int32_t)errorAngle*P8[PIDLEVEL]/100;
to:
PTerm = constrain((int32_t)errorAngle*P8[PIDLEVEL]/100,-D8[PIDLEVEL],+D8[PIDLEVEL])
A high D8[PIDLEVEL] would give same levelling as current method - so it could be made permanent
Any thoughts??
Hi,
First of all let me introduce myself :
I am not a FCWii flyer... as I am rather on the Microchip side of the force
. I have been designing my JPWiiMultiCopter board and soft for more than one year, starting from KKcopter code, then Mike Barton's one then had a look to Alex's code... How impressive job
So I would like to thanks Alex for all the job he did for this wonderful firmware.
So I definitively wrote my own firmware and designed my own board based on PIC24FJ256GB106. It is a 16bits MCU with a lot of powerful options includng hardware multiplication on 16bits (one clock step) and 9 very efficient hardware PWM (to control motors easily)
If you want to know more on my quad, my boards and all this stuff jump here :
http://www.modelisme.com/forum/aero-autres-modeles/158474-jp-wii-multi-copter.htmlI am currently flying with ITG3200 Gyros + BMA180 accelero. Both are coupled using the FCWii 1.9 hybridation technics (adapted to PIC) and latest PID stuff also adapted to PIC.
Until today only the Rate mode was working well (very well indeed) but the LEVEL mode was also drifting... quite a lot as my quad isn't very new and the propeller really unbalanced (one has even a hole on the trailing edge...)
I have thus implemented the ACCTrim and it worked better.
And I have, right now, tested your latest proposal to "clip" the PTerm range.
The result is great and I have no longer "loops of the death" which is also very confortable !
However the drift is always there... and my understanding of the PID force me to say that it should be cause by something else than the PID...
I have compensated it with the ACCTrim.
I must alos say that as I am using the BMA180 Accelero and as it is calibrated from factory, I do not perform Pre flight calibration of accelero...
So I like your idea to limit the range of the PTerm :
PTerm = constrain((int32_t)errorAngle*P8[PIDLEVEL]/100,-D8[PIDLEVEL],+D8[PIDLEVEL])
and on my PIC it gives : PTerm = constrain((long)(errorAngle)*Kp[LEVEL]>>5, -300, 300) ; (pretty much the same but don't compare the values, both MCU are very different... my errorAngle is 16*angle(deg)... my Rc range is +-1000 etc...
A question to the Arduino Pros : is the division hardware coded on Atmega ? If not (as on the PIC) you'd rather use the "shift" operation and manage to divide by a power of 2 to gain time...
And to finish a video of my quad with your code
http://www.youtube.com/watch?v=4jP0EEwm43MAgain a great thanks to Alex.
JP