Multiwii 2.4 ALT Hold calibration

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
ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Hi,

I have problems with ALT hold with version 2.4. With Version 2.3 it was working not bad. I hope that someone could help.
I am running Crius AIO version 2.0 using MS5611 on Quad copter F450 based.
It is very difficult to adjust the ALT HOLD while it is very sensitive.
I reset PI and played with D first. Above D Values of 2-3 the copter will easily shoot high to sky.

Few questions:
1. Should #define ALTITUDE_RESET_ON_ARM be enabled? (by default it is disabled).
2. When doing ACC calibration, does the code check for the Baro temperature?
Should the ACC calibration be done when the Baro is cooler? meaning disconnect the power let it cool down and apply the calibration immediately after connecting?
3. I compared between the 2.3 and 2.4 code and found some related difference
in IMU.cpp version 2.3
baroGroundTemperatureScale = ((int32_t)baroTemperature + 27315) * 29.271267f;
alt.EstAlt = (alt.EstAlt * 6 + BaroAlt * 2 ) >> 3; //additional LPF to reduce baro noise (faster by 30 µs)

in IMU.cpp version 2.4
baroGroundTemperatureScale = ((int32_t)baroTemperature + 27315) * (2 * 29.271267f); // 2 * is included here => no need for * 2 on BaroAlt in additional LPF
alt.EstAlt = (alt.EstAlt * 6 + BaroAlt ) >> 3; //additional LPF to reduce baro noise (faster by 30 µs)
Are the differences equivalent and do the same in both versions?

Any other advices please.
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

ravid824 wrote:...
1. Should #define ALTITUDE_RESET_ON_ARM be enabled? (by default it is disabled).
...
David


If this option is set then every time you arm your multicopter the altitude will be set to 0 otherwise the altitude will only be set to 0 at powerup or when you calibrate the gyros.
It has nothing to do with GPS hold.

Leo

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

What is recommended, should I enable ALTITUDE_RESET_ON_ARM.
I am not using GPS HOLD yet until I will be able to stabilize the ALT HOLD.
Any other Idea why the PID is so sensitive?
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

There is no recommendation for the ALTITUDE_RESET_ON_ARM option, it's personal preference.
I use it as I want to have the baro set to 0 every time I arm my quadcopter.

I can't help you with your other questions, sorry.

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Thanks for your help Leo
Regarding the GPS Hold. It has the option of GPS take over the Baro.
If I use the GPS Hold it will do the ALT Hold instead of the Baro?
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

David,

the BARO is used in both ALT hold and GPS hold (to hold altitude).

This is how I calibrated the BARO: http://www.multiwii.com/forum/viewtopic.php?f=17&t=5347

Leo

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Leo
Do you mean that when I turn on GPS Hold it should also activate the ALT Hold?
If yes, I could also see in the GUI that the ALT Hold is turning on?

I tried the GPS Hold mode and it looks to be much more stable. With ALT Hold only mode it behave crazy,
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

When you use GPS Hold the baro is used to hold altitude.

Since we have similar Quads here is my setup for reference:
Image

For what it's worth I'm not experiencing the symptoms you describe.

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Got it, thank you

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

Have a look at this: http://www.multiwii.com/forum/viewtopic.php?f=8&t=6675

I haven't done the modifications yet so I can't confirm if it works correctly.

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Leo
I almost gave up on Multiwii. I am now switching to MegaPirate NG to see how this will be working.
Do you have any experience with MegaPirate NG?
I will also try to apply the suggestion from the link viewtopic.php?f=8&t=6675
It looks interesting since this typo as mentioned .
alt.EstAlt = (alt.EstAlt * 7 + BaroAlt) >> 3; // additional LPF to reduce baro noise (faster by 30 µs) // corrected
should have a big affect on the ALT Hold. I am not sure what the deadband is doing. I will review the code again.
Please update us after applying the fixes.
Thanks for following up.
David

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Leo

BTW, regarding your PID settings, after my ROLL/PITCH/YAW tuning I have very close results to yours.
I wished I could achieve the same on the ALT HOLD settings. I am going to try to re-seat the board and better dump vibrations. Thanks for your advice about the other forum thread, it is very interesting.
David

happul3
Posts: 44
Joined: Mon Apr 21, 2014 1:54 am

Re: Multiwii 2.4 ALT Hold calibration

Post by happul3 »

ravid824 wrote:Leo

BTW, regarding your PID settings, after my ROLL/PITCH/YAW tuning I have very close results to yours.
I wished I could achieve the same on the ALT HOLD settings. I am going to try to re-seat the board and better dump vibrations. Thanks for your advice about the other forum thread, it is very interesting.
David


David,

Please ignore this if you already knows this: the alth hold mode in multiwii uses two entirely different signals. If you are serious about troubleshooting your problem, the first logical step is to determine which signal is responsible for "shooting" up. One of the signals comes from baro, another one comes from accelerometer (well, it is the acceleration component projected onto earth gravity vector; because of this projection the gyro also play a role). P and I are fed solely by baro, the D is fed by accelerometer and (slowly, through complementary filter) by baro as well. So, if you set D=0 (and, obviously, P non zero), you can test whether baro is responsible for odd behavior you are observing. On the other hand, setting P=I=0 and D non-zero is less useful because both signals are still used. If you are interested in testing alt hold mode with pure accelerometer you'll need to edit code, specifically eradicate baro component in the complementary filter.

Depending on the results of troubleshooting you'll understand what to fix: adding more foam to baro or protecting accelerometer from vibration or just tweaking PID values. Based on my personal experience with three very different multicopter builds, multiwwii alt hold works quite well with moderate piece of foam over ms5611 and no vibration isolation of FC at all. Props should be reasonably balanced. It does take time to tune PIDs, but it helps to understand inner workings of he algorithm. It helps even more to make modification to code in order (1) to do real-time tuning with pots and (2) to log PID components through bluetooth. For example, see viewtopic.php?f=8&t=4992#p50083

Hope this helps.

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

David,

download my modified GUI.

Hook up the QC and run the GUI. First keep the QC on the table and see if the BARO curve looks like mine (above post).

Next move the QC up and down slowly and watch the ACC curves. Are the differences in a reasonable level and consistent to your movements?

Press the "s" key to make screen shots and post them if you would like us to see the graphs.

Leo

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Mr. happul3
The information you provided is new to me since all other documentations I found on the internet describes differently.
For example it says that the PID I component compensate for battery voltage drop.
Very interesting that the accelerometer is involved with the ALT HOLD. I was so concentrated on the BARO and it might me that my problem is as simple as calibrating the accelerometer again.
I will run some trials with D=0 to test the BARO only. Can you please explain what each one of the P I components do in this case?

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

David,

I'm surprised you are asking these questions because the answers are in this post : http://www.multiwii.com/forum/viewtopic.php?f=8&t=6660&sid=d2d905fc8c9bfb89caa64f4ad11fc8f4#p65277

Did you not read it?

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Leo
Until now my understanding was
P - means how much copter should relay on the baro sensor. Higher the value is, stronger the copter relays on the Baro reading.
I - is used to compensate drift costed by battery voltage drop during the time. Higher the value is faster the copter will react to voltage drop ( or other factors ).
D - means how strong the copter should react on data from the accelerator. It is used to react on small up and down movements. Higher the value is copter will react faster/stronger to the small altitude change.
What happul3 wrote is slight different in regard to the I component.

Anyway I couldn't find the Modified GUI, I will send the screenshot once I have it.
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »


ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Running windows 7 64 bit and couldn't run your version. It open a transparent window and hung.
Anyway here is the screen shoot from my MultiWiiConf came with MW 2.4.
Untitled.png

Thanks
David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

OK, that looks normal to me....

I'm at a lose now since ALT HOLD is working for me with the same version and same config as you.

Now I'm worried that my GUI isn't working on your computer :?

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Thanks for the clarification.
Maybe I didn't follow the instructions for your Conf version. The folders content came with version 2.4 has besides of the MultiWiiConf.exe file few more dlls. What I download from your link only has the MultiWiiConf.exe file.
Below is the folder content of your release
Untitled1.png

Should I copy any files?

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

I know this is your thread but I think it would be better to talk about the GUI in the other thread :)

Could you post there...

Don't want to get off-topic here ;)

happul3
Posts: 44
Joined: Mon Apr 21, 2014 1:54 am

Re: Multiwii 2.4 ALT Hold calibration

Post by happul3 »

ravid824 wrote:Leo
Until now my understanding was
P - means how much copter should relay on the baro sensor. Higher the value is, stronger the copter relays on the Baro reading.
I - is used to compensate drift costed by battery voltage drop during the time. Higher the value is faster the copter will react to voltage drop ( or other factors ).
D - means how strong the copter should react on data from the accelerator. It is used to react on small up and down movements. Higher the value is copter will react faster/stronger to the small altitude change.
What happul3 wrote is slight different in regard to the I component.

Anyway I couldn't find the Modified GUI, I will send the screenshot once I have it.
David


David,

The stuff about I-component and battery drop is not wrong, but that is just one way of interpreting what code does (or intended to do). In actuality, I-component is in no way directly fed by battery voltage. The only signal that feeds into I-component is baro sensor. I recommend reading about PID loop in general to understand the relationship between P and I in multiwii. Multiwii is pretty much standard in that respect. But D is quite different in the sense that it feeds by both acc (fast) and baro (slow). Also, it is important that you understand the ambiguity in sentence "D - means how strong the copter should react on data from the accelerator." In principle, word react might mean enhance or it might mean suppress. In the general context of PID loops both implementations are useful. In case of multiwii, the D-component is designed to *oppose* any (perceived) vertical motion, including even that requested by pilot with stick input. That unfortunately makes alt hold mode even less responsive and difficult to troubleshoot.

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

Today on this gorgeous morning I thought I'd do a position hold test using the following code:

Code: Select all

baroGroundTemperatureScale = ((int32_t)baroTemperature + 27315) * 29.271267f;
and

Code: Select all

alt.EstAlt = (alt.EstAlt * 3 + BaroAlt ) >> 2;

Satellite reception was poor due to active geo field and solar x-ray. I usually have 10-11 sats.

Here is a short video of the test (watch in HD):


In my opinion it works well. What do you guys think?

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Very nice. At what height do you trigger the ALT Hold?
It looks like 6-7 meters. Could you have good ALT HOLD in lower levels such as 3-4 meters ?

David

User avatar
Leo
Posts: 372
Joined: Wed Sep 17, 2014 7:01 am
Location: Germany
Contact:

Re: Multiwii 2.4 ALT Hold calibration

Post by Leo »

Pos Hold was triggered at 9 meters. It doesn't matter at what height you trigger PH as long as it's not too low that the QC may hit the ground.

I usually do my photo shots of the QC at 3-4 meters hold.

ravid824
Posts: 26
Joined: Wed Jul 29, 2015 3:59 am
Location: California

Re: Multiwii 2.4 ALT Hold calibration

Post by ravid824 »

Leo
I am playing with Cleanflight which is an extraction and improved MW firmware.
They introduced a new PID algorithm what is called Multiwii PID (renew).
ALT Hold work there quite well. It also supports SONAR which help a lot when the Copter is low.
I wish that our developers will move forward fast and resolve some of the Multiwii issues faster.

Post Reply