MultiWii 2.0 is coming

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Magnetron
Posts: 124
Joined: Tue Jul 05, 2011 4:32 pm

Re: MultiWii 2.0 is coming

Post by Magnetron »

Cronalex wrote:
Cronalex wrote:sorry guys .. but I solved the problem by enabling // Moving Average Gyros by Magnetron1 (Michele Ardito) ########## beta

#define MMGYRO // Active Moving Average Function for Gyros
#define MMGYROVECTORLENGHT 10 // Lenght of Moving Average Vector

The quadricopter is stable now, but now I wonder why? if it is activated not working .. I before using this version I used the 1.9 with Average Gyros


moving average of the gyros is really good... I have to try that on the accelerometers I keep you informed!!!

for now I have a problem loading I get this error:

MultiWii_2_0.cpp: In function 'void getEstimatedAltitude()':
MultiWii_2_0:1337: error: 'AccZHigh' was not declared in this scope
MultiWii_2_0:1337: error: 'AccZLow' was not declared in this scope

stay tuned!!! :)

Magnetron wrote:Alex, please implement in future version my moving average for gyros and for accs... users on BaroneRosso (italian forum) will appretiate it - they tell me days over days the success of moving averaging stability improvement, please add my comments also that explain hot to set it and try TRUSTED_ACCZ_VEL function to stabilize altitude in association with barometric sensor...
the link on discussion...
viewtopic.php?f=8&t=1290&start=180#p10679


if it works it works like that of the gyroscopes is a bomb ... is to be loaded in the next version

you are a big Magnetron!!! :P


Hi,
here is a fully barometric routine that will solve your problem:

Code: Select all

void getEstimatedAltitude(){
  uint8_t index;
  static uint32_t deadLine = INIT_DELAY;
  static int16_t BaroHistTab[BARO_TAB_SIZE];
  static int8_t BaroHistIdx;
  static int32_t BaroHigh,BaroLow;
  int32_t temp32;
  int16_t last;
 
  // Magnetron1 (Michele Ardito) Trusted Z Acc
  #if defined(TRUSTED_ACCZ_VEL)
      #define ACCZ_TAB_SIZE   40
      uint8_t AccZindex;
      static int16_t AccZHistTab[ACCZ_TAB_SIZE];
      static int8_t AccZHistIdx;
      static int32_t AccZHigh,AccZLow;
      int16_t AccZlast;
      
      AccZlast = AccZHistTab[AccZHistIdx];
      AccZHistTab[AccZHistIdx] = accADC[YAW]; // <-- Acc Z axis value
      AccZHigh += AccZHistTab[AccZHistIdx];
      AccZindex = (AccZHistIdx + (ACCZ_TAB_SIZE/2))%ACCZ_TAB_SIZE;
      AccZHigh -= AccZHistTab[AccZindex];
      AccZLow  += AccZHistTab[AccZindex];
      AccZLow  -= AccZlast;
      AccZHistIdx++;
      if (AccZHistIdx == ACCZ_TAB_SIZE) AccZHistIdx = 0;
  #endif

  if (currentTime < deadLine) return;
  deadLine = currentTime + UPDATE_INTERVAL;

  //**** Alt. Set Point stabilization PID ****
  //calculate speed for D calculation
  last = BaroHistTab[BaroHistIdx];
  BaroHistTab[BaroHistIdx] = BaroAlt/10;
  BaroHigh += BaroHistTab[BaroHistIdx];
  index = (BaroHistIdx + (BARO_TAB_SIZE/2))%BARO_TAB_SIZE;
  BaroHigh -= BaroHistTab[index];
  BaroLow  += BaroHistTab[index];
  BaroLow  -= last;
  BaroHistIdx++;
  if (BaroHistIdx == BARO_TAB_SIZE) BaroHistIdx = 0;

  BaroPID = 0;
  //D
  temp32 = D8[PIDALT]*(BaroHigh - BaroLow) / 40;
  BaroPID-=temp32;
  EstAlt = BaroHigh*10/(BARO_TAB_SIZE/2);
  temp32 = AltHold - EstAlt;
  if (abs(temp32) < 10 && BaroPID < 10) BaroPID = 0;  //remove small D parametr to reduce noise near zoro position
  // Magnetron1 (Michele Ardito) Trusted Z Acc
  #if defined(TRUSTED_ACCZ_VEL)
      BaroPID -= D8[PIDVEL]*(AccZHigh - AccZLow) / 30;
  #endif
 
  //P
  BaroPID += P8[PIDALT]*constrain(temp32,(-2)*P8[PIDALT],2*P8[PIDALT])/100;   
  BaroPID = constrain(BaroPID,-150,+150); //sum of P and D should be in range 150

  //I
  errorAltitudeI += temp32*I8[PIDALT]/50;
  errorAltitudeI = constrain(errorAltitudeI,-30000,30000);
  temp32 = errorAltitudeI / 500; //I in range +/-60
  BaroPID+=temp32;
}

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

Re: MultiWii 2.0 is coming

Post by Cronalex »

Magnetron wrote:
Cronalex wrote:
Cronalex wrote:sorry guys .. but I solved the problem by enabling // Moving Average Gyros by Magnetron1 (Michele Ardito) ########## beta

#define MMGYRO // Active Moving Average Function for Gyros
#define MMGYROVECTORLENGHT 10 // Lenght of Moving Average Vector

The quadricopter is stable now, but now I wonder why? if it is activated not working .. I before using this version I used the 1.9 with Average Gyros


moving average of the gyros is really good... I have to try that on the accelerometers I keep you informed!!!

for now I have a problem loading I get this error:

MultiWii_2_0.cpp: In function 'void getEstimatedAltitude()':
MultiWii_2_0:1337: error: 'AccZHigh' was not declared in this scope
MultiWii_2_0:1337: error: 'AccZLow' was not declared in this scope

stay tuned!!! :)

Magnetron wrote:Alex, please implement in future version my moving average for gyros and for accs... users on BaroneRosso (italian forum) will appretiate it - they tell me days over days the success of moving averaging stability improvement, please add my comments also that explain hot to set it and try TRUSTED_ACCZ_VEL function to stabilize altitude in association with barometric sensor...
the link on discussion...
viewtopic.php?f=8&t=1290&start=180#p10679


if it works it works like that of the gyroscopes is a bomb ... is to be loaded in the next version

you are a big Magnetron!!! :P


Hi,
here is a fully barometric routine that will solve your problem:

Code: Select all

void getEstimatedAltitude(){
  uint8_t index;
  static uint32_t deadLine = INIT_DELAY;
  static int16_t BaroHistTab[BARO_TAB_SIZE];
  static int8_t BaroHistIdx;
  static int32_t BaroHigh,BaroLow;
  int32_t temp32;
  int16_t last;
 
  // Magnetron1 (Michele Ardito) Trusted Z Acc
  #if defined(TRUSTED_ACCZ_VEL)
      #define ACCZ_TAB_SIZE   40
      uint8_t AccZindex;
      static int16_t AccZHistTab[ACCZ_TAB_SIZE];
      static int8_t AccZHistIdx;
      static int32_t AccZHigh,AccZLow;
      int16_t AccZlast;
      
      AccZlast = AccZHistTab[AccZHistIdx];
      AccZHistTab[AccZHistIdx] = accADC[YAW]; // <-- Acc Z axis value
      AccZHigh += AccZHistTab[AccZHistIdx];
      AccZindex = (AccZHistIdx + (ACCZ_TAB_SIZE/2))%ACCZ_TAB_SIZE;
      AccZHigh -= AccZHistTab[AccZindex];
      AccZLow  += AccZHistTab[AccZindex];
      AccZLow  -= AccZlast;
      AccZHistIdx++;
      if (AccZHistIdx == ACCZ_TAB_SIZE) AccZHistIdx = 0;
  #endif

  if (currentTime < deadLine) return;
  deadLine = currentTime + UPDATE_INTERVAL;

  //**** Alt. Set Point stabilization PID ****
  //calculate speed for D calculation
  last = BaroHistTab[BaroHistIdx];
  BaroHistTab[BaroHistIdx] = BaroAlt/10;
  BaroHigh += BaroHistTab[BaroHistIdx];
  index = (BaroHistIdx + (BARO_TAB_SIZE/2))%BARO_TAB_SIZE;
  BaroHigh -= BaroHistTab[index];
  BaroLow  += BaroHistTab[index];
  BaroLow  -= last;
  BaroHistIdx++;
  if (BaroHistIdx == BARO_TAB_SIZE) BaroHistIdx = 0;

  BaroPID = 0;
  //D
  temp32 = D8[PIDALT]*(BaroHigh - BaroLow) / 40;
  BaroPID-=temp32;
  EstAlt = BaroHigh*10/(BARO_TAB_SIZE/2);
  temp32 = AltHold - EstAlt;
  if (abs(temp32) < 10 && BaroPID < 10) BaroPID = 0;  //remove small D parametr to reduce noise near zoro position
  // Magnetron1 (Michele Ardito) Trusted Z Acc
  #if defined(TRUSTED_ACCZ_VEL)
      BaroPID -= D8[PIDVEL]*(AccZHigh - AccZLow) / 30;
  #endif
 
  //P
  BaroPID += P8[PIDALT]*constrain(temp32,(-2)*P8[PIDALT],2*P8[PIDALT])/100;   
  BaroPID = constrain(BaroPID,-150,+150); //sum of P and D should be in range 150

  //I
  errorAltitudeI += temp32*I8[PIDALT]/50;
  errorAltitudeI = constrain(errorAltitudeI,-30000,30000);
  temp32 = errorAltitudeI / 500; //I in range +/-60
  BaroPID+=temp32;
}

yes DONE COMPILING

THE FUNCTION MUST BE // ?? to use the moving average on accelerometers:

/* This option should be uncommented if ACC Z is accurate enough when motors are running*/
/* should now be ok with BMA020 and BMA180 ACC */
//#define TRUSTED_ACCZ

???

tnx

Magnetron
Posts: 124
Joined: Tue Jul 05, 2011 4:32 pm

Re: MultiWii 2.0 is coming

Post by Magnetron »

This is config.h portion file to activate the functions:

Code: Select all

//####################################################################
// Moving Average Gyros by Magnetron1 (Michele Ardito) ########## beta
// if the I2C speed is 100kHz use MMGYROVECTORLENGHT from 2 to 6 best was 2 and MMACCVECTORLENGHT from 4 to 10 best was 6
// if the I2C speed is 400kHz use MMGYROVECTORLENGHT from 2 to 6 best was 4 and MMACCVECTORLENGHT from 4 to 12 best was 8
//#define MMGYRO                         // Active Moving Average Function for Gyros
#define MMGYROVECTORLENGHT 4           // Lenght of Moving Average Vector
// Moving Average Accelerometers by Magnetron1
//#define MMACC                          // Active Moving Average Function for Accelerometers
#define MMACCVECTORLENGHT 8            // Lenght of Moving Average Vector
// Moving Average ServoGimbal Signal Output
//#define MMSERVOGIMBAL                  // Active Output Moving Average Function for Servos Gimbal
#define MMSERVOGIMBALVECTORLENGHT 16   // Lenght of Moving Average Vector
/* Trusted AccZ Velocity Vector Magnetron1
/* This option should be uncommented if ACC Z is accurate enough when motors are running*/
#define TRUSTED_ACCZ_VEL


the line
//#define TRUSTED_ACCZ
is indipendent from my routines... I suggest you to leave it activate (without //)

karsten j.
Posts: 16
Joined: Mon Mar 05, 2012 7:22 am

Re: MultiWii 2.0 is coming

Post by karsten j. »

Hi

I have a question regarding the Lipo-Alarm built in the software
This is the code

/* for V BAT monitoring
after the resistor divisor we should get [0V;5V]->[0;1023] on analog V_BATPIN
with R1=33k and R2=51k
vbat = [0;1023]*16/VBATSCALE */
#define VBAT // comment this line to suppress the vbat code
#define VBATSCALE 131 // change this value if readed Battery voltage is different than real voltage
#define VBATLEVEL1_3S 107 // 10,7V
#define VBATLEVEL2_3S 103 // 10,3V
#define VBATLEVEL3_3S 99 // 9.9V
#define NO_VBAT 16 // Avoid beeping without any battery

means, the buzzer should slowly beep at 10,7 V , shouldn´t it ?
But when I connect a full 12.4 V Lipo battery, the Buzzer beeps ....
What figures must I change to avoid this ?

Karsten

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

Calculate vbatscale

Post by fr3d »

karsten j. wrote:Hi

I have a question regarding the Lipo-Alarm built in the software
This is the code

/* for V BAT monitoring
after the resistor divisor we should get [0V;5V]->[0;1023] on analog V_BATPIN
with R1=33k and R2=51k
vbat = [0;1023]*16/VBATSCALE */
#define VBAT // comment this line to suppress the vbat code
#define VBATSCALE 131 // change this value if readed Battery voltage is different than real voltage
#define VBATLEVEL1_3S 107 // 10,7V
#define VBATLEVEL2_3S 103 // 10,3V
#define VBATLEVEL3_3S 99 // 9.9V
#define NO_VBAT 16 // Avoid beeping without any battery

means, the buzzer should slowly beep at 10,7 V , shouldn´t it ?
But when I connect a full 12.4 V Lipo battery, the Buzzer beeps ....
What figures must I change to avoid this ?

Karsten

it's not a mw 2.0 error ...
may be you do not configure right the vbatscale value I use 121
...or you have swapped you resistor...
check your lipo battery voltage (ex :12v6)
check you midle point voltage betwen the 33k & 51k (ex:3v85)

some maths :

3.85 * [(1024/5)] = 3.85 * [204.8] = 788.48

788.48*16 = 12615.68
12615/126 =100 (126 is your 12.6v in mwc :mrgreen: )
100 is your vbatscale
simple non ?

warthox
Posts: 65
Joined: Sat Jan 29, 2011 10:05 pm

Re: MultiWii 2.0 is coming

Post by warthox »

there seems to be a problem with hex x config in fw2.0

today i tried the actual fw 2.0. it flew ok but sometimes in left roll there was something wrong.
it seemed that the left motor, connected to A0, reacts wrong.
in a left roll the motor should decraese rpm but instead the rpm increased for some seconds and fighted against the other motors on the left.
this happened not everytime i made a left roll. 3 times in the flight of maybe 4min. doesnt happen in the other directions.

fc. mwc board with pro mini and freeimu v0.4.3
A0 and A1 for left and right motor.
ppm sum rx.

Joachim08
Posts: 31
Joined: Sat Mar 17, 2012 10:10 am

Re: MultiWii 2.0 is coming

Post by Joachim08 »

At the end of the day i sadly switched back to 1.9...
There are too many bugs in 2.0 for me so i cannot fly my quad without
problems.

Maybe i try it again with another IMU which i have just ordered from Drotek...

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

Another mw 2.0 bug

Post by fr3d »

today I've play with my little quad I 've noticed a strange bug,
I'was flying with a level pid "D" term less then 100,@ 90 exactly, the copter level smoother but after a moment the copter fall down....
may this help in debugging the "buggy" 2.0.

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

Re: Another mw 2.0 bug

Post by Alexinparis »

fr3d wrote:today I've play with my little quad I 've noticed a strange bug,
I'was flying with a level pid "D" term less then 100,@ 90 exactly, the copter level smoother but after a moment the copter fall down....
may this help in debugging the "buggy" 2.0.

please be more accurate: "after a moment the copter fall down"

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

Re: MultiWii 2.0 is coming

Post by Alexinparis »

warthox wrote:there seems to be a problem with hex x config in fw2.0

today i tried the actual fw 2.0. it flew ok but sometimes in left roll there was something wrong.
it seemed that the left motor, connected to A0, reacts wrong.
in a left roll the motor should decraese rpm but instead the rpm increased for some seconds and fighted against the other motors on the left.
this happened not everytime i made a left roll. 3 times in the flight of maybe 4min. doesnt happen in the other directions.

fc. mwc board with pro mini and freeimu v0.4.3
A0 and A1 for left and right motor.
ppm sum rx.


Hi Markus,
There is apparently a bug about HEX configs (and probably octo) on a promini with 2.0.
I will try to reproduce it.

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

Re: Another mw 2.0 bug

Post by fr3d »

Alexinparis wrote:
fr3d wrote:today I've play with my little quad I 've noticed a strange bug,
I'was flying with a level pid "D" term less then 100,@ 90 exactly, the copter level smoother but after a moment the copter fall down....
may this help in debugging the "buggy" 2.0.

please be more accurate: "after a moment the copter fall down"

copter stay stable (original wmp+nk+bmp085) during 30/40 secondes and
slowly descend until it touch the grass, waiting for another set of propeller to retest :evil:
original pid settings used
if i put Level D term at 100 everythings seems to be ok...
may this help.

karsten j.
Posts: 16
Joined: Mon Mar 05, 2012 7:22 am

Re: MultiWii 2.0 is coming

Post by karsten j. »

Hi

I saw that there´s a new DEV Version at the downloads section .
Unfortuantely there´s no text file what has changed...
Could anybody tell us what is new in this DEV ?

Karsten

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: MultiWii 2.0 is coming

Post by LenzGr »

If the DEV version has been cut after 2.0 was released, it likely contains the following changes (from I could gather):

- new serial protocol
- Devantech SRF I2C Sonar support
- OpenLRS support
- Airplane mode
- NanoWii support
- MPU6050 support
- IC2 OLED support

karsten j.
Posts: 16
Joined: Mon Mar 05, 2012 7:22 am

Re: MultiWii 2.0 is coming

Post by karsten j. »

Hi

Where can I find the code for the I2C Sonar ?

Karsten

LenzGr
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany
Contact:

Re: MultiWii 2.0 is coming

Post by LenzGr »

karsten j. wrote:Where can I find the code for the I2C Sonar ?

It's in SVN (trunk) and included in the latest dev snapshot (MultiWii_dev_20120414.zip) - just edit config.h and uncomment the respective #define:

Code: Select all

// use the Devantech SRF i2c sensors, SRF08, SRF02
// (for now, there is no difference in the SRF0x code, but we may want to differentiate in the future.)
//#define SRF02
//#define SRF08
//#define SRF10
//#define SRF23

See this thread for the related discussion.

User avatar
mOuchadino
Posts: 15
Joined: Sat Jul 07, 2012 3:51 am

Re: MultiWii 2.0 is coming

Post by mOuchadino »

I have to try... :( Bluetooth serial can.t support with mw 2.0... but if i.m use mw 1.9 and 2.1 work fine ..... the problem seem ontxrx serial.dll.... pls help me :roll:

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

Re: MultiWii 2.0 is coming

Post by KeesvR »

Copy the rxtxSerial.dll file from MultWiiConf_2.1 to version 2.0.

But why should you use 2.0 ?

Post Reply