Is it a software bug?

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
lehar
Posts: 2
Joined: Thu Aug 29, 2013 9:06 am

Is it a software bug?

Post by lehar »

SW version: MultiWii 2.2
I think there's a bug in multiwii.ino

PTermACC = constrain(PTermACC,-conf.D8[PIDLEVEL]*5,+conf.D8[PIDLEVEL]*5);
I think it should be:
PTermACC = constrain(PTermACC,-conf.P8[PIDLEVEL]*5,+conf.P8[PIDLEVEL]*5);

Sebbi
Posts: 478
Joined: Sun Jul 08, 2012 1:08 am
Location: Germany
Contact:

Re: Is it a software bug?

Post by Sebbi »

Short answer:
no

Long answer:
A PID controller has a proportional term (P), an integral term (I) and a derivative term (D). MultWii uses a full PID controller for gyro based corrections, but only a PI controller for accelerometer based corrections. The D value is instead used to limit the influence of the accelerometer ... the D term is generally not used when the signal source is noisy and leads to jumps.

User avatar
alll
Posts: 220
Joined: Fri Dec 07, 2012 9:53 am

Re: Is it a software bug?

Post by alll »

Sebbi wrote:... the D term is generally not used when the signal source is noisy and leads to jumps.


worth reading...
http://wearcam.org/absement/Derivatives ... cement.htm

lehar
Posts: 2
Joined: Thu Aug 29, 2013 9:06 am

Re: Is it a software bug?

Post by lehar »

okay, is there a document or a short description, how each PID works? (differs from a standard PID controller, etc. use D as some other than D parm)

User avatar
alll
Posts: 220
Joined: Fri Dec 07, 2012 9:53 am

Re: Is it a software bug?

Post by alll »

You are dreaming, some will say "it's all in the code"..., to my knowledge there is not (yet)

rbirdie001
Posts: 178
Joined: Fri Apr 01, 2011 10:32 pm
Location: Czech Republic, Prague

Re: Is it a software bug?

Post by rbirdie001 »

Hi!
I don't want to open new thread for my obsevations when there is similar topic ;) .
I think I may have a found bug in the MWI 2.2 code and it seems to be present even in next developement versions. It is in accelerometer I term influence in default "tradional" PID loop (option 1) in HORIZON and ANGLE modes. In short the I term of Accelerometer PI loop have incorrect influence while P term works as it should. See ilustration videos:
At first video is tricopter lying on the ground and tail is supported by a brick so ROLL axis is levelled and PITCH axis is tilted to front. It has loaded stock MWI 2.2 withou any modification.
In acro mode all motors are running equally because no movement so no gyro corrections.
In the first part I adjusted just P term for the LEVEL, I term was 0. When I activated (at 0:07) HORIZON, front motors speeded up and rear motor slowed down because P term tries to compensate tilt on PITCH but both front motors are still have the same speed (because ROLL is levelled). That's OK.
Then I adjusted I term constant to 0.069 which is more than default but still reasonable value and again activated HORIZON mode (0:28 and again 0:42).
You can see that motors first did the same as before but very fast right motor started speed up more than left one so it looks like that I correction to PITCH is incorrect because this shouldn't affect left/right motor balacing. Hear "narrator" :-)

http://www.youtube.com/watch?v=z2rAY_X_u3w

For complete image I repeated tests with a quad in angle mode and for both axis - again I'm afraid that results is, that something is strange.
No narration here, but see the cursor. Always one axis is levelled and one is tilted. When only P term is applied, there is correct influence of ANGLE mode but after applying I term there is a strange behaviour.

http://www.youtube.com/watch?v=HOAfjeJoBiY

I did short tests with the newer PID algoritm (option 2) and it seems to work fine.
Because I'm not experienced in code, I hope that someone from programmers can look at it and possibly correct it or correct me ;) .
Thanks!
Roman

Post Reply