Inflight ACC-calibration

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

Re: Inflight ACC-calibration

Post by Noctaro »

Hi!
I tested your last release, and it seems to work for me now. I have tested it with my Arduino Pro Mini on AUX1 and AUX2.
Both of them do the trick. Its really cool, for now i do not have to trim ACC more then one or two clicks.
I did not test it with baro, as my BMP085 produces to high jumps.

Will keep up testing.
Thank you for coding this.

Greetz Noc

freedom2000
Posts: 5
Joined: Mon Dec 26, 2011 3:29 pm

Re: Inflight ACC-calibration

Post by freedom2000 »

Hi,

This inflight ACC-calibration is really a clever idea ;)

I have adopted it for my JPWiiMultiCopter and slightly modified the logic to prevent going to LEVEL mode if the inflight calib has not been done yet.

So my logic is :

1) At the end of Arming procedure, chaeck if the left stick is in the upper left corner and if yes allow AccAutoCalibration

Code: Select all

if(RxIn[CH2] < -STICKARM_POINT)    AccAutoCalibrationMeasurementDone = 0;


2) whatever is the position of the "Rudder Switch" forbid to go to LevelMode if not calibrated

Code: Select all

      if (SwRUD)   
      {   
         if (AccAutoCalibrationMeasurementDone) accMode = 1; //LEVEL mode allowed only when ACC calibrated...
      }    
      else   
      { accMode = 0;
      }   //switch Gyro/Level modes


3) perform the Acc calibration (more or less) as yours :D

Code: Select all

//***********************************************
// ACC autocalibration
//***********************************************
      if ((!accMode) && (SwTRN) && (!AccAutoCalibrationMeasurementDone ))   //enter autocalibration of Accelero when in accro mode and switch trainer ON
      {   
         if (!AccInflightcalibrating )
         {
            AccInflightcalibrating = 1;            //now calibration starts
            AccAutoCalibrationMeasurementDone = 0;
            for (i =0; i<3; i++)
            {
               AcceleroZero[i]=0;   //reset the offsets
               AcceleroStoreZero[i] = 0;
            }
         }
         else
         {
            if (AccInflightcalibrating < 129)                        //   perform average of 128 readings   
            {
               for (i = 0; i<3; i++) AcceleroStoreZero[i] += AcceleroADC[i];
               AccInflightcalibrating++;      
            }
            else                                             // 128 values read
            {
               for (i =0; i<3; i++) AcceleroZero[i] = AcceleroStoreZero[i]>>7;   
               AcceleroZero[YAW]-= acc_1G;
               AccAutoCalibrationMeasurementDone = 1;   
               AccInflightcalibrating = 0;                           // calibration finished
            }
         }


The result is great you can't make mistake even if you start not calibrated (excepted if you calibrate when the quad is tilted...)
You can start your quad in level mode... it will remain in Accro mode until you push the "Trainer switch" then perform the calibration then automatically jump to Level mode
If you disarm it will keep the calibration excepted if you rearm "on upper left side"


I have tested it in flight --> simply amazing almost impossible to notice the mode change.

Thanks for this GREAT auto calib mode

JP

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

Re: Inflight ACC-calibration

Post by KeesvR »

@ Alex: Why don't you use this function in the Dev versions?

It's working great and really handy.

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

Re: Inflight ACC-calibration

Post by jevermeister »

hmm,

I am unsure, shall I add it to the shared trunk by myself?

I do not know if it good Kung Fu to do it.


Nils

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

Re: Inflight ACC-calibration

Post by KeesvR »

Hi Nils, I say yes, it should be much easier for me.

Yesterday I've tried to place this in the dev, but I did something wrong somewhere.
It's difficult for me, it all look like Chinese for me.

The latest dev is so good for me, I only need a little bit of trim (5 clicks) before it was about 40 clicks.

Edit: I saw you changed the min- and maxcheck values in the multiwii.pde, is this for your setup only or for all setups?

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

Re: Inflight ACC-calibration

Post by jevermeister »

I will trty it but the dev features new combis, I have to test it really carefully.

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

Re: Inflight ACC-calibration

Post by KeesvR »

Have you seen my latest question.

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

Re: Inflight ACC-calibration

Post by jevermeister »

It is for my setup, the HK T6A TX has some problems with the stock min max values, it does not reach them.

Sorry if it caused you trouble but you should always check with winmerge before using the software. I made this mistake once. Copter crashed badly...

Nils

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

Re: Inflight ACC-calibration

Post by KeesvR »

No, no problem for me, I leave it as it was so that was a good idea.
I was not sure about it so that's why I asked this.

I've always thought when you want to change this, you could do this in the config.h.
Now I've seen I was mistaking.

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

Re: Inflight ACC-calibration

Post by Alexinparis »

Hi,

The latest dev is so good for me, I only need a little bit of trim (5 clicks) before it was about 40 clicks.

The last devs includes a 8G setting for ACC sensors which should increase the angle reliability.
So it might explain your observation.

Anyway, if you feel this function is still really useful after this adjustment, feel free to include it in the _shared branch.
hints:
- isolate the code via relevant #define
- keep local variable only inside functions for clarity (accZero_saved, accTrim_saved)

User avatar
Hamburger
Posts: 2580
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: 2580
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: 2580
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: 2580
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: 2580
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: 2580
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: 2580
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

Post Reply