Inflight ACC-calibration

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Jevermeister,

it seems your auto leveling code has gone a long way. I would like to chime in, if you don't mind. Your thread had started me thinking about it - especially when last time I did level-tuning with fly-land-disarm-sticks-arm cycle over and over again.

1.
your code is about the acc (level) calibration done during flight instead of iteratively changing offsets with THR-up + PITCH/ROLL increments while disarmed, right?

2.
Idea: Basically just fly and whenever you think copter is in a good level, hit the 'snapshot level' button on your TX and be done.
the procedure I would like to see is
a. fly copter in level mode
b. use sticks for yaw, nick, roll so copter is trimmed out
c. take 'level snapshot': push button or flick switch at TX (auxN) to take current RX-values and change mwii internal offsets accordingly (and write them to eeprom)
done.

As always, this LearnLevel function could be assigned to any AUXn high/mid/low value the user wanted.
Actually, what I describe is much more. It could the same way be used as a direction hold. Set copter according to wind into direction, learn, and fly with that orientation without any more active stick input (apart from throttle).


Now, I am not sure if this is that much different from what you described. My description is shorter and the usage procedure seems simpler?

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

Re: Inflight ACC-calibration

Post by jevermeister »

I am happy you are joining us.

1. You are right: I compute the offset to the current ideal position and safe it to eeprom.
2. I use acro mode to find the perfect function because I use the failsafe to trigger the offsetmeasurement. I did this to avoid using aux and block other functions.
Problem is: my Aux1 is: OFF, ARM+ACRO ARM+HOVER.
Leveling out in Acromode is pretty easy but I can try your way too. Either use failsafe trigger or an aux switch.
- writing to eeprom should be done while on the ground, sometimes the cicletime increases drastically and you might crash...

Can you descirbe you last statement reagird the wind for stupid people like me ;-).

nils

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

jevermeister wrote:I am happy you are joining us.

Nils, my pleasure. I got bored with the current level tuning procedure lately. I read you are close to submitting your version to _shared. So bear with me if what I write has been thought through before (I am late and maybe just catching up).
1. You are right: I compute the offset to the current ideal position and safe it to eeprom.
2. I use acro mode to find the perfect function because I use the failsafe to trigger the offsetmeasurement. I did this to avoid using aux and block other functions.
Problem is: my Aux1 is: OFF, ARM+ACRO ARM+HOVER.
Leveling out in Acromode is pretty easy but I can try your way too. Either use failsafe trigger or an aux switch.

For me, I almost always fly in level and that is when I want this learn-level function.
- writing to eeprom should be done while on the ground, sometimes the cicletime increases drastically and you might crash...

yes, writing to eeprom is slow. You could drastically reduce time required if you only wrote the relevant 4 (?) bytes. Not sure how to compute the relevant offfsets into eeprom.
Can you descirbe you last statement reagird the wind for stupid people like me ;-).

I thought of flying in windy conditions. To hover stationary, you have to apply some nick/roll constantly. Provided you can keep heading, you could learn-level the neccessary tilt angles by pressing that tx button and from then on use that as your new level-values (and not have to fight the wind as long as you head in same direction)

Let me ramble on and offload some thoughts:
you do use the angle trims for this, right?
Just a thought, we could instead read the deltas for rx-inputs from midrc for yaw,nick,roll. Not sure how that would differ.
Second:
About using the new learnt offsets right after pressing the tx-button:
- need to find a good time for writing to eeprom, or maybe not if it is easy enough to do during flight
- after having learnt the new offsets (either for angles or rx-inputs); should these be applied right after that? Beware, the pilot still gives some tx-input for nick&roll like before; but that is not required anymore -> copter shoots in that direction; maybe not good.
But maybe not too bad, if the original tilts wer not too extreme. So a good idea to instantly use the new learnt offsets.

I would like to have the system learn the yaw value delta from midrc the same way. For TRIs I have made the servo midpoint value a configurable item already (via LCDconfig).
About how to trigger the learning of the offsets to level :
the procedure you have described earlier using failsafe sounds kinda scary to me. It is so contra to usual flight behaviour. I think having an auxN button/switch is much more following the usual user experience. Again, using an auxN switch brings up a question: detect the change of this auxN state and do the learn-level thing once and from then on ignore the auxN status? Or start learning constantly and take the last (averaged?) values before the auxN state is left again?

aux buttons - we are short on those always. So the sequence you described would help with that.

My expectation on a use case would be:
1. fly as much as I want, then fly level (in acro or level mode) and suddenly decide 'want to learn this as level'
2. hit button/flick switch (or trigger another way, but stick combos are no-go during flight)
3. at that moment of positive ramp up of signal take offsets
4. use learnt offset from that moment on (yes, if flying in level mode, expect some unwanted movement before pilot moves sticks back to center)
5. ignore auxN from then on (unless switched off and on again - new positive ramp up)
6. at disarm, write offsets to eeprom
7. if you know you made mistake/do not like the level offsets, then do calib acc; it zeroes out the acc trim values.

What do you think?

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

Re: Inflight ACC-calibration

Post by Noctaro »

Hey,
i did read your posts about auto level.
Are you sure it would be an good idea to have a constant level offset? Think of landing, or windspeed drops :? (Maybe an angle limitation?)(GPS should be able to counteract wind also)
If you land and do forget that you have applied a big offset, wouldnt it drift off as crazy at next startup? Will eeprom be cleared?
What if pulling the wrong aux switch during flight, would we have to counteract the new level position?

greetz,
Noctaro

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

Re: Inflight ACC-calibration

Post by jevermeister »

Noctaro wrote:Hey,
i did read your posts about auto level.
Are you sure it would be an good idea to have a constant level offset? Think of landing, or windspeed drops :? (Maybe an angle limitation?)(GPS should be able to counteract wind also)
If you land and do forget that you have applied a big offset, wouldnt it drift off as crazy at next startup? Will eeprom be cleared?
What if pulling the wrong aux switch during flight, would we have to counteract the new level position?

greetz,
Noctaro



I wanted to say the same,
just think of an offset to the west, and you accidently turn your copter and have wind from west and an offset to the east, you will definetily loose the copter, it happenend to me once, I pushed hard against the wind and accidently jawed , I was unable to recover the drift and the copter crashed badly.

I will try to do the following:

Arm the function alike I do now to use the failsafe method to store the offset.
additionally I will include the aux switches.
I will test storing to eeprom inflight, but I do not think this is a good idea because you are still correcting the drift with the tx and suddenly the drift is gone, because the new trimming kicks in, so you will drift to the opposite site without doing somethin, some people might be confused and crash.

cya
Nils

See u later.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

ok, you code, so you decide. (and it is open source, so we get to change).
Go for it and let Alex have his say so.

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
I just tested it, EEPROM writing while airborne is a really bad idea ;-) I was lucky nothing was broken.
Your Idea of changing a single variable sounds good, but I have to ask alex how to do it.

I did the following:
Armin the function over combo sou you can use the failsafe method.
Alternatively: Flick a switch while flying and hover without drit and the offset is stored, land and flick the switch back. Values are stored to eeprom.
Now I need a aux binding in the GUI.
@Alex, can you give me a variable and a representation for this function in the coming gui?

Nils

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

you can add another var to the checkboxes mechanism yourself. We changed the code to make that a lot easier than it was before.

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

Re: Inflight ACC-calibration

Post by jevermeister »

Okay, and does it show up in the gui aotmatically!?

About the checkin:

1.Checkout the shared trunk
2.applay the changes
3.commit changed checjout into shared tunk

Correct!?
Nils

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Inflight ACC-calibration

Post by Alexinparis »

Hi,
I would prefer to not add another checkbox item for this. The GUI is nearly full...
You can maybe use the pass trough checkbox: this checkbox is only relevant for fix wing configs and has currently no usefulness for multi rotor configs

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

Re: Inflight ACC-calibration

Post by jevermeister »

Alexinparis wrote:Hi,
I would prefer to not add another checkbox item for this. The GUI is nearly full...
You can maybe use the pass trough checkbox: this checkbox is only relevant for fix wing configs and has currently no usefulness for multi rotor configs


Hey Alex,
confirmed, I can understand that. Together with de if defined accinflight this makes sense.



Nils

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

Re: Inflight ACC-calibration

Post by jevermeister »

Okay,
just commited it into multwii_shared:

Log message

Added InflightAccCalibration
A. Using BoxPassthru
1. Start and eliminate drift (hover, acro),activate Passthru (Beep,beep)
2. Land and deactivate Passthru: beeeep. new value stored
3. take back any trims!!! start again: no drift.

B. Alternatively using Stick Combi (to save aux channels):
1. before starting: stick Combo:
Low throttle + Yaw Left + Pitch forward + Roll right: Beep Beep,
function armed (do it again to disarm: beep beep beep)
2. Start and eliminate drift (hover, acro).
3. turn off motors while airborne (failsafe will prevent crash): beep
4. Land and do combo again: BEEEEP, values are stored
5. take back any trimming an start again: no drift

Affected files expand all collapse all
Modify /trunk/MultiWii_shared/MultiWii.ino diff
Modify /trunk/MultiWii_shared/Sensors.pde diff
Modify /trunk/MultiWii_shared/config.h diff

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Feport:
I use activation v ia passthru bound to TX button.
When I a cidenfally turn off while sfill flying Copter crash. Frame broken.
End of experiment.

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

Re: Inflight ACC-calibration

Post by PatrikE »

I have a issue...
Acc-trim on airplane .
Start,test,Land,Trim;Satrt,Test,land,Trim................

Inflight ACC-calibration would be great in the airplane and Heli.

If i use Inflight ACC-calibration on airplane and helicopter and use Passthru...
Acc will calibrate every time i switch to Passthru.!.. :o

I suggest using Both Passthru and Beeper to actvate Inflight ACC-calibration.

Is it a possible thing to do?
Just fly level in passthru and flipp BeeperSwitch.
Land and save settings.
Or is it's possible to save in air?

/Patrik

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

Re: Inflight ACC-calibration

Post by jevermeister »

Oh sh...

sorry to hear that Hamburger, I hope the damage wasn't too expensive. I think I owe you one.

I found a few glitches regarding the implementation of the switch, it was not compatible to the arming method of the combo, but that does not explain your crash.

Do you want to describa what happenend exactly?

What did you turn off? The Pass thru button or the arming button.
Was the crash a constand cascading drift without the possibility to control the copter? If yes, the Saving to eeprom process has been started.

Regarding the airplane mode, I will concentrate onto the issue Hamburger had, until this is fixed for sure: feature freeze. But you can map the function to another box, I am not too happy with the use of passtrhu either but alex asked me not to implement another button. deactivate the passthru metho in the code and use the combo.


Nils

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Nils,
jevermeister wrote:sorry to hear that Hamburger, I hope the damage wasn't too expensive. I think I owe you one.

it seems I collect too many, recently!
I was willing to test it, but from code in _shared I did not expect such drastic response. Ah, live and learn.
I found a few glitches regarding the implementation of the switch, it was not compatible to the arming method of the combo, but that does not explain your crash. Do you want to describa what happenend exactly?

Here is what I did:
- assign activation via passthru to TX switch
- set switch to OFF
- arm, fly in level mode, recognize some drift, so want to do your callibration thing
- use TX sticks to keep copter steady, turn TX switch ON
- fly some more seconds
- while flying, accidentally turn TX switch OFF again -> copter flips, crashes, breaks.
- the end.

I did not check the code - is eeprom write done when TX-switch->off, regardless of armed status?

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

Re: Inflight ACC-calibration

Post by jevermeister »

I coded it the way that you will have to land for writing to eeprom, writing to eeprom while airborne will lead to a crash.

I check the variable "armed". onl if armed = 0 the routine will write to eeprom, but I found out that armed is set to 0 even if the failsafe prevents the motors to stop becaus minthrottle is not applied.

I am on it.

Nils

ygl611
Posts: 9
Joined: Mon Mar 05, 2012 1:29 am

Re: Inflight ACC-calibration

Post by ygl611 »

Thanks jevermeister's methods of Inflight ACC-calibration,it works!

After tried it serveral times , I changed some code ,so my Inflight ACC-calibration like this:

1.Calibrate gyro and ACC as usual , Armed,then continiue Keep RC sticks in Armed over 4S untill LED flash.
2.Start and use trim to eliminate drift (hover, ACRO or Level mode,I prefer to Level mode), activate MAG (or Headfree, Passthru,just chang the code ), LED stop flash and then on.
3. Land and deactivate MAG, Throttle lowest(< mincheck), new value stored
4.Take back any trims!!! start again: no drift.

Senors.pde, line 281, coment this to save loop time

Code: Select all

//blinkLED(10,10,2);      //buzzer for indicatiing the start inflight


MultiWii_dev_20120225.ino
Add inflightcalibratedAccTime

Code: Select all

void annexCode() { //this code is excetuted at each loop and won't interfere with control loop if it lasts less than 650 microseconds
  static uint32_t buzzerTime,calibratedAccTime;
  static uint32_t inflightcalibratedAccTime;


Instead of :

Code: Select all

 if ( (calibratingA>0 && (ACC || nunchuk) ) || (calibratingG>0) ) {  // Calibration phasis
    LEDPIN_TOGGLE;
  } else {
    if (calibratedACC == 1) {LEDPIN_OFF;}
    if (armed) {LEDPIN_ON;}
  }


To be:

Code: Select all

  if ( (calibratingA>0 && (ACC || nunchuk) ) || (calibratingG>0) ) {  // Calibration phasis
    LEDPIN_TOGGLE;
  } else {
    if (calibratedACC == 1) {LEDPIN_OFF;}
    if (armed) {
      #if defined(InflightAccCalibration)
        if ( AccInflightCalibrationArmed ) {
          if (currentTime > inflightcalibratedAccTime) { inflightcalibratedAccTime = currentTime + 50000; LEDPIN_ON;}
        }
      else
      #endif 
     {LEDPIN_ON;}
    }
  }


Instead of :

Code: Select all

#if defined(InflightAccCalibration)  
        else if (armed == 0 && rcData[YAW] < MINCHECK && rcData[PITCH] > MAXCHECK && rcData[ROLL] > MAXCHECK){
          if (rcDelayCommand == 20){
            if (AccInflightCalibrationMeasurementDone){                //trigger saving into eeprom after landing
              AccInflightCalibrationMeasurementDone = 0;
              AccInflightCalibrationSavetoEEProm = 1;
            }else{
              AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
              if (AccInflightCalibrationArmed){blinkLED(10,1,2);}else{blinkLED(10,10,3);}
            }
          }
       }
#endif


To be:

Code: Select all

#if defined(InflightAccCalibration)  
        else if ( (rcData[YAW] > MAXCHECK || rcData[ROLL] > MAXCHECK) && rcData[PITCH] < MAXCHECK && armed == 1 && calibratingG == 0) { 
          if (rcDelayCommand == 200){
              //calibratingA=400;
              AccInflightCalibrationArmed = !AccInflightCalibrationArmed;
            }
        }
        else if(AccInflightCalibrationMeasurementDone){                //trigger saving into eeprom after landing
              AccInflightCalibrationMeasurementDone = 0;
              AccInflightCalibrationSavetoEEProm = 1;
              blinkLED(10,10,2);
        } 
#endif


Finally, comment some sentence, "!rcOptions[BOXARM]" changed to "rcOptions[BOXMAG]"

Code: Select all

#if defined(InflightAccCalibration)  
      if (AccInflightCalibrationArmed && armed == 1 && rcData[THROTTLE] > MINCHECK && rcOptions[BOXMAG] ){              // Copter is airborne and you are turning it off via boxarm : start measurement
        InflightcalibratingA = 50;
        AccInflightCalibrationArmed = 0; 
      } 
      /*if (rcOptions[BOXPASSTHRU]) {      //Use the Passthru Option to activate : Passthru = TRUE Meausrement started, Land and passtrhu = 0 measurement stored
        if (!AccInflightCalibrationActive && !AccInflightCalibrationMeasurementDone){
          InflightcalibratingA = 50;
        }
      }else if(AccInflightCalibrationMeasurementDone && armed == 0){
        AccInflightCalibrationMeasurementDone = 0;
        AccInflightCalibrationSavetoEEProm = 1;
      }*/
#endif


Sorry for my terrible English , i'm from China, Hope you like this method to calibration ACC in flight!

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

Re: Inflight ACC-calibration

Post by Noctaro »

Hey,
sounds nice! Wich version of multiwii did you use for your mods? I would like to give it a try. May you upload a moded archive of the firmware you used? Thanks for sharing your idea :)

greetz Noc

ygl611
Posts: 9
Joined: Mon Mar 05, 2012 1:29 am

Re: Inflight ACC-calibration

Post by ygl611 »

Noctaro wrote:Hey,
sounds nice! Wich version of multiwii did you use for your mods? I would like to give it a try. May you upload a moded archive of the firmware you used? Thanks for sharing your idea :)

greetz Noc


Multiwii 20120225,the lastest Multiwii 2.0 aslo works! :)

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
I was in the GPS code. Sorry for not stating. I changed the buzzer code so blinkled is not used.
Can you post a diff of your changes?It would be easier to underatand.

Thanks for revisiting the code.Glad to see you guys are interested in it.

Nils

User avatar
howardhb
Posts: 189
Joined: Tue Oct 11, 2011 7:10 pm
Location: Port Elizabeth, South Africa

Re: Inflight ACC-calibration

Post by howardhb »

Just tested In-flight calibration with V2.0 preversion2 using stick method.

My copter has ITG3205, BMA180, HMC5883L and BMP085 with PPM SUM with Spektrum Orange clone 6ch receiver.
Using SuperSimple HK-HW20A ESC's flashed with latest SimonK firmware: Very big improvement in stability - smooth flying copter.
http://www.rcgroups.com/forums/showthre ... update+esc

I arm the motors using AUX1

I don't have a buzzer connected (Parisv4.0 r3) ,but I do have LED strips, and it displays 2 short flashes when activating the calibration mode before take-off.
(stick method - Throttle low, yaw left, pitch forward, roll right)
Then, after trimming (level mode) using trim levers on my transmitter, I flipped motor switch to OFF (AUX1) I saw 3 short flashes?
(motors did NOT stop in flight! hahahaha)
Land the copter. (copter dis-arms automatically as throttle is lowered to zero - AUX1 is still low/off)

Apply "stick method" again, I saw 3 flashes.

zero "trim" on transmitter.

Armed the copter and took off again.....perfectly level.
Hover hands off for 10 seconds.... Perfect! :mrgreen:

Thanks @jevermeister.

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

Re: Inflight ACC-calibration

Post by jevermeister »

Good to hear that it is working as intended.
Thank you for your feedback.

Nils

User avatar
fr3d
Posts: 97
Joined: Sun Feb 06, 2011 11:21 am
Location: Cappelle la grande near the ch'ti village
Contact:

Re: Inflight ACC-calibration

Post by fr3d »

plz can someone confirm to me "inflight calibration procedure"
I can arm motor from an aux channel ...
after trimming as used to in acro mode (transmitters subtrims)
and leveled mode (motor off throttle max a few stick mouvements on roll and pitch depend of leading)
my copter is pretty stable in both configurations now :lol:

inflight calibration procedure :
motor off (off course... -> ->)
I do the "stick method" to arm inflight calibration (yaw left, throttle min, pitch max, roll right)
I must see 2 flashs ... on/off/on/off with power led
do I I enable stab mode from my transmitter ? [stable led(red) is on ]
I arm motor power led, [stable led] and motors are on
I take off
I disarm motor :o
I trim with my transmitter in order to get a rock solid stable mode :?
I land, motors stop at min throttle :D
I do the stick method once's again
I put my trim at zero/null point, not subtrim right ?
I can dust off now with arm switch
is it correct ?

on my futaba I have subtrim (a modified neutral point in a menu ) and trims switch near sticks.
regards

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

Re: Inflight ACC-calibration

Post by jevermeister »

Correct.

The trim method via transmitter is ok if u do not need to swtisch between hover and acro mode, but if you are satisfied with trimming in hover and switch to acro you copter can make severe dvings. I do not use trimmmings for nick and roll, only fpor yaw and throttle. It is too dangerous imho.

Nils

User avatar
fr3d
Posts: 97
Joined: Sun Feb 06, 2011 11:21 am
Location: Cappelle la grande near the ch'ti village
Contact:

Re: Inflight ACC-calibration

Post by fr3d »

ok, in usual flight I flight in acro mode, I use only stable mode when I lose my copter orientation this mode save copter's life many time because with quadcopter all sides are l the same.... even with leds and colored propeller
at far distance you can't see anything... :twisted: only fighting against gravity.... :!: http://www.youtube.com/watch?v=9CsZBu88lEM
I would like to make a fpv quadX-8 so. A good hover mode will be needed and I will surrely switch between acro and hover mode without this it will be boring a bit :D .

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Hi Nils,
to be more conform with rest of code I just submitted a change of macro spelling from InflightAccCalibration to INFLIGHT_ACC_CALIBRATION.
Hope you don't mind.
Cheers, Hamburger

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: Inflight ACC-calibration

Post by Tazzy »

Hello Nils
I did try your calibration procedure and it works ok BUT when i switch off throttle activation in flight the quad will tilts hard to right a couple of meters then i can land and save .... have you seen this problem before ? i have a paris v3 bord with nk and wm+ all orginal, Barro and mag ...
Its kind off scary to activate in air ;)

// Tazzy

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

Re: Inflight ACC-calibration

Post by jevermeister »

@ Hamburger: No Problem at all, I am glad the function stays in the code ;-)

@Tazzy: I nboticed that effect once, I need to do some testing again. But I do not have much time left right now, I will try to do some testing on sunday.

Hope I find the bug..

User avatar
fr3d
Posts: 97
Joined: Sun Feb 06, 2011 11:21 am
Location: Cappelle la grande near the ch'ti village
Contact:

Re: Inflight ACC-calibration

Post by fr3d »

Tazzy wrote:Hello Nils
I did try your calibration procedure and it works ok BUT when i switch off throttle activation in flight the quad will tilts hard to right a couple of meters then i can land and save .... have you seen this problem before ? i have a paris v3 bord with nk and wm+ all orginal, Barro and mag ...
Its kind off scary to activate in air ;)

// Tazzy

can't remember but I'm almost sure you have to do a good level calibration on your desktop, for exemple, with multiwiiconf. And you have to calibrate your copter with standard acc calibration (motor off, stable on, throttle stick at mximum, then a few sticks mouvements on opposite side of leading, ex:copter tilt to the right make a few roll left stick mouvements ...) after that inflight calibration will be easyer.

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
I made a short glimpse at the code and I think the badly drift problem is related to this:


Code: Select all

          // Clear global variables for next reading
          accADC[axis]=0;
          accZero[axis]=0;


I do this 50 cycles and then I store the values. I think this causes the drift...

In stable conditions this shouldn't be a problem but If you have some wind ore other disturbing parameters this will cause a adrift.

I have to zero these values to do a correct calibration, I will rethink that.

Sorry for the inconvenience guys...

EDIT:
Absolutely untrue!!!
The drift also happens in ACRO mode with no ACC included in the control process, so this might be a problem with the cycle time...

Nils

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: Inflight ACC-calibration

Post by Tazzy »

fr3d: I did a desk calibration on both wm+ and nk and also a "manual" adjust first then i tested a inflight acc cal and it will fly hard to left before i will get it to stop .... then i land and save to eprom and all is perfect callibrated .....

I did try this 3 times this morning and it do the same all the time .....

So the conclusion is try this in safe area and on good hight not low like i did ;)

// Tazzy

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: Inflight ACC-calibration

Post by Tazzy »

Nils
yes when you say cycle time i think we are on the right way ....
i have high cycle time at normal about 5800ms but it fly good so i have never care about it

// Tazzy

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
I took a close look at the code and I believe it may be this part:

Code: Select all

        if (InflightcalibratingA == 1) {
          AccInflightCalibrationActive = 0;
          AccInflightCalibrationMeasurementDone = 1;
          blinkLED(10,10,2);      //buzzer for indicatiing the start inflight


the blink LED Command stops the code for a few moments, maybe it is causing this behavior.

Unfortuenally I was unable to test it inflight in my basement...

I have very bad weather right now and I am unable to flight right now, can someone check my theory by removing this line in sensors.pde line #302:

Code: Select all

        blinkLED(10,10,2);      //buzzer for indicatiing the start inflight


Please be careful not to crash your copter.


Nils

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

Re: Inflight ACC-calibration

Post by jevermeister »

Okay,
it is the blinkLED command.
One can see a severe rise in cycletime if the blinkled is activated,
I replaced it with togglebeep in the trunk.

SORRY!!

Nils

Tazzy
Posts: 75
Joined: Sun Jun 19, 2011 4:45 pm
Location: Sweden

Re: Inflight ACC-calibration

Post by Tazzy »

Sorry Nils for my slow reaction i have been on skii holiday.
I will test it out asap when im back at home and have some better weather
Thanks for the good work :)

// Fredde

jrt4fun
Posts: 11
Joined: Fri Mar 16, 2012 2:37 pm

Re: Inflight ACC-calibration

Post by jrt4fun »

Hi,

The inflight acc-calibration is working great.

Quad stays rock solid, no drift.
Afterwards activated the 'alt hold' --> hands off hovering

Great coding job :)

Next to test is my other quad with the Mega board + GPS... hoping for some good wheather

Version 2.0
Crius Multiwii SE
Keda 20-50S 8A 1088kv
Hobbywing 10A esc

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Inflight ACC-calibration

Post by Federico »

Hi, I am using MultiWii 2.0
I don't understand if the inflight calibration is ready in my software version and I don't get how to use it...
Is there an official "manual" for this calibration function?
Thanks!
Federico

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

Re: Inflight ACC-calibration

Post by jevermeister »

You are right, there is no doc right now.

I provided one in the SVN code but we should add one in the FAQ.
I will contact alex on that topic.

Nils

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Inflight ACC-calibration

Post by Federico »

Thank you, going trough the forum looking for docs it's a bit difficult. I am going to check out the SVN code in the meantime.
By the way, I can't wait to try this out. Thanks for your work!
Fede

Cronalex
Posts: 51
Joined: Tue Mar 20, 2012 8:41 pm

Re: Inflight ACC-calibration

Post by Cronalex »

with the DX6i can use this function?


User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Nils, good howto.
two Q:
1. with passThrough method - is there now some protection against writing eeprom during flight (while still armed)?
2. both step5: with trim to revert to neutral you mean trim on the TX?

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,
the Code only writes to eeprom if the switch is took back AND motors are off ;-)

BTW.: The EEPROM write crashes the copter because of the loong beep. There is a wait command in that buzzer routine, if we delete that it should be possible to write into eeprom inflight.
BUT I think you should avoi changing parameters while inflight: bad idea!!!

2. Take back tx trimming, correct

Nils

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: Inflight ACC-calibration

Post by Hamburger »

Nils,
ok. thanks for the quick reply (and the fix for 1.) That copter frame is glued together long since, so I can activate that feature for good now.
Hamburger

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Inflight ACC-calibration

Post by Federico »

I don't get one thing but it's probably because english is not my language. Take back trims means that I have to set them to neutral, 0 ?

With my usual copter I have trimmed my transmitter and I have no drift. If I remove this trim and I don't use accelerometers because I don't switch them on (sometimes), should I expect drift?

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hey fede,

usually you trim an aircraft to get neutral behavior. In case of a copter with hover and acro mode this is dangerous.
If you trim your hover mode so the copter does no drift in hover and switch to acro. it will bank into the direction you moved your trim. a trim is nothing less than constantly applying a stick movent into a direction. it is the same like compensating a drift "by hand"

angular velocity and absolute angle are two very different principles and cannot mix.

So even alex says: "Do not use tx trim"
He implemented the triming method via stick inputs to insert a trim into the eeprom to deal with the drift you nearly always get - because every copter is a little croocked or an acc is not exactly levely soldered etc.

In case of this funciton you temporarily use the trims on your tx to achive a neutral point without any drift and transfer the difference between the original neutral point into the ram of the copter.
after landing it calculates a new neutral point and writes it to the software trim i mentioned above.
If you start now without taking the tx trims back it will drift very bad because you add a deviation to a deviation. so you will have to move all trimming sliders on your tx to neutral to achieve a secure flyable copter.

please accept the following advice: I use acro mode to auto calibration because using acc is not very elegant and uses time. but you have to be good in acro flying to do that.

Federico
Posts: 64
Joined: Thu Apr 05, 2012 12:32 am
Location: Italy
Contact:

Re: Inflight ACC-calibration

Post by Federico »

Thanks! Now it's really clear. You should add this to your howto , it will be useful for noobs too :-)
I am going to try and report the restult!

p25o1
Posts: 33
Joined: Thu Mar 29, 2012 3:19 pm

Re: Inflight ACC-calibration

Post by p25o1 »

hi all,

the inflight calibration is a very cool idea, and very practical to use.

for me i end up changing the camera location on the quad frequently, so i always have to go in loops (take off->observe->land->tune->takeoff->loop) to calibrate.

i tried to enable the in flight calibration, but i get "toggleBeep" declaration error in Sensors.ino

i'm using 2.1 dev and also tried r949.

Anyone faced this before?

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

Re: Inflight ACC-calibration

Post by jevermeister »

Hi,the problem is already spotted and fixed in the shared trunk.
The variabledeclaration was in a if defined block but the variable usw was not. these things happen if someone does not make a proper testbench run.

:-/

Nils

Post Reply