Inflight ACC-calibration

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Inflight ACC-calibration

Post by jevermeister »

Hi,

I uploaded a new function into my branch of the SVN:

svn/ branches/ jevermeister/ 1.9_inflight_acc_calibration

The function is described as follows:

A copter is never perfect, if you do a ACC calibration at the ground, you never have a perfectly leveled ground or an exactly built copter.

I thought about an inflight acc calibration.
So basically what happens is:

1. You arm the function with a stick combo and take off as usual
2. you either trim the hover mode using the trims on the rx until it is perfectly level and not drifting or you use the acromode until it is leveled
3. you now hit the "arm" switch (usually aux1/aux2) and turn off the engine. Don't worry the code does not turn off the engines - there is a failsafe feature.
4. The copter now takes 50 measurements of the current angle and stores them in ram.
5. After landing you have to transfer the new values into the eeprom with a stick combo.

The stick combo for both actions is:

Throttle down and yaw left + pitch forward and roll right
Image

every command is commited by a beep.
I applied that code into my copter and I believe it is working.
Anayway some users have problems with it, so I would be very happy with some feedback on that.
If you have better ideas please share them to help me improve the code.

You fin the changes in the multwii.pde and in sensors.pde, jsut do a winmerge with the multiwii 1.9 code
Last edited by jevermeister on Mon Nov 14, 2011 2:45 pm, edited 1 time in total.

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Very cool idea! I will give it a try tomorrow!

greetz Noc

flyman777
Posts: 55
Joined: Mon Sep 19, 2011 1:44 pm

Re: Inflight ACC-calibration

Post by flyman777 »

Ok,

If I understand your meaning, i get a hover level in acro mode with the TX trims and then switch off ARM.
Then the mcu will calculate the angles and store them in RAM.
The transfer in eeprom will occurate later on ground, motors disarmed, with the Tx sticks combo like ACC calibration.

I see one problem, not every people uses the ARM fonction.
Mostly we have 1 tx 3 way switch available ( AUX1+PROMINI) . So if we have OFF-ACC-MAG (or BARO) e.g.and there is no way to have a ARM fonction.
So the record of acc angles may be made by switching from OFF to ACC in flight ( in case of a 5 channels RX (AUX1) = to be universal).
So after leveling in acro mode (ACC = OFF), we can switch in ACC mode and the values are transfered in eeprom.
This would need a flag which will be reseted when we make the stick combo for acc calibration.

Best regards
flyman777

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

couldnt we do something like this?
Set a variable true if ACC calibration is activated.
If this variable == true
switching aux1 will not activate stable mode but capture the sensor readings.
Set it to false after completing the procedure.
Wich would enable stable mode again.
(I am a noob coder, just guessing)

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Noctaro wrote:couldnt we do something like this?
Set a variable true if ACC calibration is activated.
If this variable == true
switching aux1 will not activate stable mode but capture the sensor readings.
Set it to false after completing the procedure.
Wich would enable stable mode again.
(I am a noob coder, just guessing)



this sounds very good, I will try to code that,

@Alexinparis, I need some help with the timeout for the stick commands, I do not want to inerfere with all the other stick combos, so I use my own wait time.
Do you have some advise for me?

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

flyman777 wrote:Ok,

If I understand your meaning, i get a hover level in acro mode with the TX trims and then switch off ARM.
Then the mcu will calculate the angles and store them in RAM.
The transfer in eeprom will occurate later on ground, motors disarmed, with the Tx sticks combo like ACC calibration.

I see one problem, not every people uses the ARM fonction.
Mostly we have 1 tx 3 way switch available ( AUX1+PROMINI) . So if we have OFF-ACC-MAG (or BARO) e.g.and there is no way to have a ARM fonction.
So the record of acc angles may be made by switching from OFF to ACC in flight ( in case of a 5 channels RX (AUX1) = to be universal).
So after leveling in acro mode (ACC = OFF), we can switch in ACC mode and the values are transfered in eeprom.
This would need a flag which will be reseted when we make the stick combo for acc calibration.

Best regards
flyman777


You can use pin 8 or 12 for aux2, i do the same with my promini.
And i don't have a 3 way switch on my DX6i, but i use 2 switches and some mixing for aux1.

User avatar
UndCon
Posts: 293
Joined: Mon Feb 21, 2011 2:10 pm

Re: Inflight ACC-calibration

Post by UndCon »

The problems I see is that many users have shields from various suppliers - none of mine has more inputs than Mode( acro/level)
(Jussi shields, Paris board, Flyduino board)

I cannot use shields if I want to use more features... unless I solder a separate wire from 6th channel to an available Arduino pin...
All added features are really cool but not accessible...

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

You won´t need more than AUX1 to calibrate it, if Jevermeister is able to code this feature with a "disable stable mode" variable. I think, then you will not have to change any hardware connections.

@Jevermeister
By the way, i am sorry to say, have to delay testings. I will give you feedback as soon weather and time support me :)

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

@Jevermeister, Do you want to use the latest 1.9 for the next release, i had some glitches with this version.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

I will reupload it tomorrow with the newest code from alex and a first try of your ideas, thanks for your input

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Thats great! Looking forward to it! :)

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Okay, I applied Alex's fix2 on both uplaoded files.

Change of arm following tomorrow.

Nils

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

couldnt we do something like this?
Set a variable true if ACC calibration is activated.
If this variable == true
switching aux1 will not activate stable mode but capture the sensor readings.
Set it to false after completing the procedure.
Wich would enable stable mode again.
(I am a noob coder, just guessing)


I thought about your idea noctaro but I think it is very dangerous to play with the meaning of the aux switches.

You may loose the copter in an emergency situation.

I think I have to find something different:

- What about switching of the TX for a couple of seconds? I believe it is a bad idea though...

- A count down?

- some function that measures fluctuation, and if the bird is stable inside of a gievn deadband we go on with measuring?
Or use a kind of throttle deadband like baro?

This might be an idea:

We try to obtain an optimal hover and the copter is constantly taking 50 values and calculate the meanvalue until I leave the throttle deadband, If the deadband has been left, the last calculated mean value will be stored.

How does this sound?

Nils

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Hey,
i thought of the same routine you explained us about.
So before takeoff we set it to calibration mode. (Acro is active) (Aux1 will only capture if we switch)
Landing and rearming brings us back to stabtle mode function of Aux1.
So we can´t start this routine during flight.
Or is there any danger i did not think of?

greetz noc

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

I think there is a certain danger.
The switch has a different function while this is happening. Different users use this switch different and we should not interfere with it by overriding Alex's system to assign functions to this switch. Think of a user who uses this switch and is relying on it and accidently arms the function and the switch looses the function he uses without him knowing it.

I should talk to alex about that.

What do you think of the deadband solution!? No switch is needed:

1.Arm function
2. start and try to obtain perfect hover, the deadband is recognised like in baro mode.
3. leave deadband and land
4. store fvalues by repeating arming combo

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Did the test again, my results are:

I always need to trim to left and front.
When i do the inflight calibration and land after switch off the motors, i see in the Gui that the ACC values are changed.
I do not the stick movement to store the values to eprom.
Roll = 52
Pitch = -42
The roll and pitch signs are tilted.
When i try to fly then in stable mode i need to trim to the opposite side (right, back)

When i do the stick movements to store the values, roll and pitch go back to normal.
But then i need to trim as much as before to left and front, so nothing changed.
I did this several times always the same result.

Some extra info, when i fly level with bluetooth connection and look at the Gui the values for roll and pitch are something about the half as what i see while the inflight calibration.
Roll around 25 and pitch around -20.

I hope this is good information for you.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

KeesvR wrote:Did the test again, my results are:

I always need to trim to left and front.
When i do the inflight calibration and land after switch off the motors, i see in the Gui that the ACC values are changed.
I do not the stick movement to store the values to eprom.
Roll = 52
Pitch = -42
The roll and pitch signs are tilted.
When i try to fly then in stable mode i need to trim to the opposite side (right, back)

When i do the stick movements to store the values, roll and pitch go back to normal.
But then i need to trim as much as before to left and front, so nothing changed.
I did this several times always the same result.

Some extra info, when i fly level with bluetooth connection and look at the Gui the values for roll and pitch are something about the half as what i see while the inflight calibration.
Roll around 25 and pitch around -20.

I hope this is good information for you.



Thank you for your help.
Based on your experience I did some tests again and I sometimes had the same result.

Then I noticed, that, everytime this is happening, the buzzer did not beep inflight when I start the measuring. Somehow it is not noticing the switch off inflight.

So what is happening:
The calibration zeros all sensor value after each calibration cycle. this is why you are seeing different values. But if the measurement is not finished it will not set a specific flag.
this flag is used to make the combo to store the values into eeprom, so what you got is a zeroed out acc but not a calibrated one.

The problem is the following:
I measure 50 acc values after flipp the switch - after 50 values are taken, the finisehd flag is set. This takes some moment so if one lands too soon after starting the measurement this flag is not set and you only disarm the function via the combo after landing.

I believe this might be the solution, so we can either take fewer measuerements or wait a couple of seconds.

I learned a lesson about measurement today: Trimming in hover is not a good idea, when you switch off the calculated measurements are used a tonce -> CRASH.

So do the measurement in acro mode.

May I ask you to test again and see if it is working if you keep the time in mind?

Do you use a buzzer?

EDIT: Okay tht was too early, the time between start and stopp of the measurement is less then a second...

But the function is working for me... Can you tell me something about your setup?


Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I did it again, always in acro mode, because i don't need to trim TX.
After flipping the switch now i flew for 1 minute i guess, but the same result.

For the next test i do some re wiring to make the use of a buzzer possible.
Ill let you know.

Edit:
My setup is:
Promini
WM+ Genuine
BMA020
BMP085
HMC5883
Mounted on a Flyhigh300 V1.5
http://www.rcgroups.com/forums/showthread.php?t=1406524

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

I have a short test for you.
If you do the normal ACC calibration via Combo or GUI does the LED on the Arduino Blink?

Since I am using the same algorythm this LED also blinks after you store the Data into EEPROM after landing and doing the combo the second time.
If it does not it does not work.
Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

The normal calibration the led goes on for 2 seconds and then flashes 2 times.
Your calibration after flying I do the stick combo and i see one flash.

It's very strange it isn't working for me, and you have a good result.

We need some more testers :mrgreen:

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

KeesvR wrote:
We need some more testers :mrgreen:


affirmative!

ah I am in a chatg with a beauty right now, so I am a little distracted ;-)

good info with the LED I will have a look on that again.
Maybe I have the same...

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I'm out of testing for today so take your time with your beauty.
I prefer to do this in real life :mrgreen:

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Hi again,
I uploaded a new version a few moments ago.

You stated, that you see, that the values are changing after the inflight calibration without doing the combo.

There was a part in the standard calibration routine that zeroed all trims and offset values after echt read cycle.
I implemented a feature that saves these values before the calibration process and rewrites them after the measurement.
After the combo is done for saving the values, these values will be overwritten with the measured value and the trim data is deleted.

I did some tests and it works better now. no erratic behavior after the measurement.

How do I test.
1. I tilt the copter to front and start the normal calibration. The copter should no drift to the front.
2. start in hover to confirm that.
3. do the stick combo and start in acro until. Now try to get leveled and turn off and wait until the measurement is finished
4. land and do the combo once again
5. start in hover and check if there is no drift.

This works well with my setup and I can do it over and over again.


We should think about how to start the measurement. the "turn off" solution isn't the best.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Hi Nils, tried this one but I'm sorry to say that I've got the same result.
The only change is when i land values are zero, so this thing is working.

I also did the same test as you did, after this its calibrated as always.

May bee a stupid question, but when i think about this, isn't it the same if i calibrate on level ground or level in the air ?
As I said before I always have to use some Acc trim to compensate the offset of my Acc.

So what I want to make clear, the inflight calibration is working fine, but may bee I didn't understand you right about this function.
What I think this should do is give me a calibration and trim compensation, but I'm not sure anymore, because the calibration as you call it is working like it should.
May bee I expect to much of it. :mrgreen:

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

So after you do tje second combo you can fly and have no drift?

Imagine you are in the field and have no flat ground. Most copters are not built precise. they are not symetric or arms are bent.you will have to trim a lot. With this you only need to fly level calibrate and yoe have leveled copter.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I always have some drift to the same direction right back.
I use some Acc trim to correct this.
Don't you have this problem?

Before Alex had introduced the Acc trim, i had made me a mechanic trim for the Acc.

Image

Image

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Trim is not necessary with autocalibration.

Your mechanical trimmer, is very cool btw,is needed because your copter,as every copter is not pervectly built leveled.
This is not possible to achieve.my copter for example has flexible landing gear so it cannot be leveled on the ground.so I use inflight calibration to find that spot.

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

So I understand it right. :mrgreen:

Then I don't understand why it isn't working for me, I've always the same offset as calibrating the normal way on a level ground.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Inflight ACC-calibration

Post by PatrikE »

It works fine for me... :D
And together with Shikra's Driftkiller it's the first time i'we been able to fly a full battery in Stable mode... 8-)

I can confirm the procedure.

First set a ArmBox in the gui.
Image
Do the stickcommand.
Image

Arm the engines. (In my setup AUX High)
TakeOff in acromode.

When in hover at a stable height.
Disarm the engines. (Will not stop untill you reach minthrottle...)
Keep in hover for a couple of seconds.

Land and let the engines stop.

Final step.
Stick command again..
Image

Arm and fly...

Works flawlessly for me

/Patrik

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

PatrikE wrote:It works fine for me... :D
And together with Shikra's Driftkiller it's the first time i'we been able to fly a full battery in Stable mode... 8-)

I can confirm the procedure.

First set a ArmBox in the gui.
Image
Do the stickcommand.
Image

Arm the engines. (In my setup AUX High)
TakeOff in acromode.

When in hover at a stable height.
Disarm the engines. (Will not stop untill you reach minthrottle...)
Keep in hover for a couple of seconds.

Land and let the engines stop.

Final step.
Stick command again..
Image

Arm and fly...

Works flawlessly for me

/Patrik


Nice to hear that.
Finally a positive feedback, I started to doubt myself...

@keesvR:

If you have time to test it with buzzer: can you call back!?

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Yes I'll be back :mrgreen: but it can take some days before I've changed some things.

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Hi guys,
sorry for my delayed response. Had to do some travel and was not really able to do any usefull testings. I think i can start testing these days. So for my ardu mini i need to activate AUX2 to get things working? Is it ok to replace MultiWii_1_9.pde of current 1.9 with the one you provide in your branch Jever? AUX2 have to be assigned as arm switch?
Btw. may i connect a buzzer without a resistor?
Sorry for that questions. Just want to do it the right way. ;)

greetz noc

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
nice to see you again.
I arm/disarm via AUX1, you can Enable that in GUI.

We need to do it via switch at the moment until I found a good way to do that without a switch.
I modified the most up to date multiwii.pde so it should be safe to replace it.

I connected a buzzer without resistor and had do problems at all. But I use a small buzzer from Reichelt electronics - maybe you should check at the "Connecting Elemets" forum.

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Thanks for your fast reply!
Thats all info i needed to start right away! I will give a feedback as soon as possible.

Noctaro
Posts: 280
Joined: Thu Sep 08, 2011 11:15 am
Contact:

Re: Inflight ACC-calibration

Post by Noctaro »

Hey,
i uploaded your patch today. I did not connect a buzzer right now, but i thought it will not be a problem for real.
At GUI i started to test the stick combination you posted, armed and held quad way of rolled in my hand for several secounds after switching off the armed mode and simulated a landing.
After doing the combination again, i could not see any changes. Maybe i got something wrong.

Did not test it in real flight conditions for now.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

When you press the "Calibrate ACC" Button in GUI, you notice that all graphs of the ACC are going to 0 for a short time (Best noticeable while watching ACC Z (going from 1 to 0 and back to 1 after some time)).

When you simulate a flight and switch to off to start the calibratin inflight you should see the same behavior but for a shorter time (only 50 values are computed instead of 400).

Do you see that behavior!?

Nils

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Inflight ACC-calibration

Post by PatrikE »

It works fine for me.
After the acc-calibration i need 2 trimsteps with the sticks to get it perfect.

Be shure to follow this stages.
http://www.multiwii.com/forum/viewtopic.php?f=7&t=893&start=20#p5774

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Oh I forgot something: You have to give some throttle or the failsave wont start!
The measurement only starts if the switch ist flicked to 0 while the motors RX value for throttle is >minthrottle.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I did some changes to my connections.
I made pin 12 free for Aux2, now i can use pin 8 for the buzzer.
I have no buzzer so connected a led to pin 8, but it is constant flashing.

Do i need to connect the resistors for the lipo alarm to make this working?
I did this earlier on the quad of my brother in law with led strips with no problem.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Inflight ACC-calibration

Post by PatrikE »

Disable battery code.

Code: Select all

//#define VBAT              // comment this line to suppress the vbat code

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Thanks Patrik, I'm gonna try this but not today.

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I found out that the calibration is not working right for me.
I've installed a led in place of the buzzer, when this led flash I call it a beep.

When I do the stick combo 2 beeps.
Arm the motors (done this with motorstop and without)
When i give a little bit of throttle I have 2 beeps, this means start calibration but to early, because I'm not in the air yet.
In the air turn off the motors by switch no beep.
Land and do the stick combo 1 beep.

I've looked in my TX for some strange mixing on throttle stick, but nothing found.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Okay KeesvR,
first of all: Thank you for your patient in detail testing - I really appreciate that!

How do you arm your motors!?

The following clause is used to trigger the inflight measuring:

Code: Select all

if (AccInflightCalibrationArmed && armed == 1 && rcData[THROTTLE] > MINCHECK && (rcOptions & activate[BOXARM] != 1


It also triggers the two beeps (flashes)

You are stating that this clause is triggered directly after you throttling up.:

AccInflightCalibrationArmed must be set by the Combo, CHECK
armed is true when the motors are spinning, CHECK
rcData[THROTTLE] > MINCHECK means you moved the stick. CHECK


I think this might be the problem:

(rcOptions & activate[BOXARM] != 1

This code is waitng for the switch to be flicked from armed to not armed. You need a switch on aux1 or Aux2 to arm the copter. Can you post a screenshot of your parameters in GUI just in case!?

Are you using sumPPM signal or are all channels connected to the Board by individual wires.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

I use Aux2 to arm the motors.
I don't use sum PPM

I see that line in my code is different to yours.
if (AccAutoCalibration && armed == 1 && rcData[THROTTLE] > MINCHECK && (rcOptions & activate[BOXARM] != 1) ){ // Copter is airborne and you are turning it off : start measurement

Attachments
V1.9.JPG
Last edited by KeesvR on Sun Nov 27, 2011 8:52 pm, edited 1 time in total.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
I tested your setup and come to the same conclusion.
If I use the arming on Aux 2 it starts to calibrate right after throttling up.

So my code is too specific for my setup. Give me a couple of hours to find the issue.
Sorry for that. But I just cheered and stopped thinking after it worked for me.

Nils

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,

I found the reason and fixed it:

Instead of:

Code: Select all

if (AccInflightCalibrationArmed && armed == 1 && rcData[THROTTLE] > MINCHECK && (rcOptions & activate[BOXARM]) != 1 ){ 


it has to be:

Code: Select all

if (AccInflightCalibrationArmed && armed == 1 && rcData[THROTTLE] > MINCHECK && !(rcOptions & activate[BOXARM]) ){ 


Stupid setup specific mistake.
I tested it with Aux 2.

I uploaded the new code into my svn branch, also notice, that the buzzer code is now in an extra .pde, so you can better find out my code and eliminate it if you like to.
be sure to download multiwii.pde, buzzer.pde and sensor.pde

I would be happy to hear if it is working for you now.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Tested with Aux1 and it's working fine.

Edit: Tomorrow I do the test with Aux2, for now it wasn't working.
I only changed the line you showed, this gave me no beeps after the stick combo.
I'm gonna download your new code to be sure.

I had some trouble to get the Aux2 working, it suddenly didn't work anymore.
Why do I have some stupid Throttle Hold switch on my TX :oops: After I switched it back Aux2 was working again.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
so is it working with Aux1 and Aux2 for you!?

If yes, that would be great.
I tested it outside today an was pretty happy with it.
I still have a hard time holding the copter in acro but that is my lack of flight experience ;-)

Maybe Alexinparis notices this function and finds it interesting. I am still unhappy with the combo, there has to be a better way...

It is a bummer that I onlay have two Aux channels, I have so much functions I want to use.

Nils

KeesvR
Posts: 194
Joined: Fri May 27, 2011 6:51 pm
Location: The Netherlands

Re: Inflight ACC-calibration

Post by KeesvR »

Nils your the best :mrgreen: finally it''s working for me with Aux 1 and 2.
Yesterday it wasn't working because i was a bit tired, today with a fresh mind i did some changes i had to do and it's working perfect.

The only thing i see after calibrating is the rising of the ACC Z value.
Normal this is 255 for the BMA020 and now 320.
I don't know if this is a problem for other functions like baro.

You said that the calibration time takes less than a second after flipping the switch, maybe you can stretch this up to 5 or 10 second.
I think this is better, but I'm not sure.
What do you think about this?

When the lipo is almost empty, the switch doesn't work. With full lipo no problem.
You said the switch sometimes doesn't work, I think this is the reason.

I also hope Alex use this in the next version, it's a really nice way to calibrate next to the normal way.

User avatar
jevermeister
Posts: 708
Joined: Wed Jul 20, 2011 8:56 am
Contact:

Re: Inflight ACC-calibration

Post by jevermeister »

KeesvR wrote:The only thing i see after calibrating is the rising of the ACC Z value.
Normal this is 255 for the BMA020 and now 320.
I don't know if this is a problem for other functions like baro.

This will be a problem for the baro. I will have to take a closer look but it is connected to the fact that the accZ value drops when the motors are running, there is a thread for that, the guys over there are on the bproblem, it is a parameter problem of the bma020 in special. I do not think I can solve that problem right now. Because the vibrations affect the z reading a lot!

KeesvR wrote:You said that the calibration time takes less than a second after flipping the switch, maybe you can stretch this up to 5 or 10 second.
I think this is better, but I'm not sure.
What do you think about this?

I took a short time because you have to manually level the copter and if you measure a long time it is more likely that movements get involved into the measurements. but some more measurements may not harm. I will try that.

KeesvR wrote:When the lipo is almost empty, the switch doesn't work. With full lipo no problem.
You said the switch sometimes doesn't work, I think this is the reason.


This is curious I will have a look.

Thank you very much for the feedback
Nils

Post Reply