Gyro_scale is wrong for MPU6050?

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download

Re: Gyro_scale is wrong for MPU6050?

Postby Hamburger » Sun May 05, 2013 1:47 pm

Use latest dev. It has the. Hanges you need.
User avatar
Hamburger
 
Posts: 2557
Joined: Tue Mar 01, 2011 2:14 pm
Location: air

Re: Gyro_scale is wrong for MPU6050?

Postby -ralf- » Sun May 05, 2013 4:08 pm

Hamburger wrote:Use latest dev. It has the. Hanges you need.


Thanks .... but two questions:

Is it necessary to clear the EEPROM before flashing the dev?
Can I use my config.h from 2.2Final?

Thanks
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: Gyro_scale is wrong for MPU6050?

Postby Plüschi » Sun May 05, 2013 4:33 pm

Since i lost my pid values many times i now do a "save" of the values in the multiwii.conf . You have to add the .mwi extension to the file name (doesent do it automatically) and it doesent save the mode switches, but it does save the numbers. When eeprom gets corrupted i do a "load", enter the switches again, then a "write".

Very useful feature :)
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Gyro_scale is wrong for MPU6050?

Postby Plüschi » Sun May 05, 2013 6:48 pm

I did some tests with a crius_se (ITG3200) and an AIO V1 (MPU6050). The test consists of start level, do a looping over pitch, level again and quick check the pitch value in conf utility. Should be zero.
I confirm the value of 2380 working excellent for the ITG3200. But for the MPU6050 i found a value of 2020 working good. My code looks like this now:

#if defined(MPU6050)
#define GYRO_SCALE ((2020 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f)) // MPU6050
#elif defined(ITG3200)
#define GYRO_SCALE ((2380 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f)) // ITG3200
#else
#define GYRO_SCALE ((2279 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f)) // dunno
#endif

Is this method correct or is there a systematical error?
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Gyro_scale is wrong for MPU6050?

Postby -ralf- » Sun May 05, 2013 7:11 pm

Hamburger wrote:Use latest dev. It has the. Hanges you need.


Sorry Hamburger,

but in Version 2.21 "#define Gyro_Scale...." is still the same (equal value for ITG and MPU) as in Version 2.20 ...
-ralf-
 
Posts: 215
Joined: Mon Dec 03, 2012 7:08 pm

Re: Gyro_scale is wrong for MPU6050?

Postby ovaltineo » Sun May 05, 2013 11:50 pm

Plüschi wrote:Is this correct ?

#if defined(MPU6050)
#define GYRO_SCALE ((1998 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f)) //(MPU6050)
#else
#define GYRO_SCALE ((2279 * PI)/((32767.0f / 4.0f ) * 180.0f * 1000000.0f)) //(ITG3200)
#endif


That is correct, but I would have written it this way coz it's easier to match with the data sheet, and a compile error would alert the user that the GYRO_SCALE is not defined for the sensor:

#if defined(MPU6050)
#define GYRO_SCALE ((4.0f * PI)/(14.375 * 180.0f * 1000000.0f)) //(MPU6050)
#endif
#if defined(ITG3200)
#define GYRO_SCALE ((4.0f * PI)/(16.4 * 180.0f * 1000000.0f)) //(ITG3200)
#endif
#if defined(L3G4200D)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f)) //(L3G4200D) this needs changes to Gyro_init and Gyro_getADC to set 2000dps and divide result by 4 instead of 20
#endif
ovaltineo
 
Posts: 15
Joined: Sun Apr 28, 2013 11:41 pm

Re: Gyro_scale is wrong for MPU6050?

Postby Hamburger » Mon May 06, 2013 8:42 am

-ralf- wrote:but in Version 2.21 "#define Gyro_Scale...." is still the same (equal value for ITG and MPU) as in Version 2.20 ...

I do not know version 2.21. It is included since dev version r1428.
User avatar
Hamburger
 
Posts: 2557
Joined: Tue Mar 01, 2011 2:14 pm
Location: air

Re: Gyro_scale is wrong for MPU6050?

Postby ovaltineo » Mon May 06, 2013 9:32 am

Where can we download the latest dev version? I can only see R1391 from the official download site. This would have saved me a lot of trouble.
ovaltineo
 
Posts: 15
Joined: Sun Apr 28, 2013 11:41 pm

Re: Gyro_scale is wrong for MPU6050?

Postby ovaltineo » Mon May 06, 2013 9:37 am

Never mind, found it under source tab.
ovaltineo
 
Posts: 15
Joined: Sun Apr 28, 2013 11:41 pm

Re: Gyro_scale is wrong for MPU6050?

Postby scrat » Mon May 06, 2013 12:55 pm

What does correction of Gyro scale - better stability or something else?
scrat
 
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Gyro_scale is wrong for MPU6050?

Postby Plüschi » Mon May 06, 2013 3:10 pm

I still dont understand why for
ltg should be 16.4 but good results are with 17.12
mpu should be 14.375 but good results are with 14.54
Any ideas?

I did check the time, but ist correct, the time in-between samples is measured each cycle.

@scrat: if this factor is wrong the copter will not stay level right after a looping
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Gyro_scale is wrong for MPU6050?

Postby ovaltineo » Mon May 06, 2013 11:43 pm

The data sheet figures are "typical" values at 2.5v VDD and 25 C temperature. Most IMUs are running at 3.3v and we don't all live in the Bahamas. Hence, real values are almost guaranteed to vary.
ovaltineo
 
Posts: 15
Joined: Sun Apr 28, 2013 11:41 pm

Re: Gyro_scale is wrong for MPU6050?

Postby Plüschi » Mon May 06, 2013 11:54 pm

TY

your a clever guy.
User avatar
Plüschi
 
Posts: 433
Joined: Thu Feb 21, 2013 6:09 am

Re: Gyro_scale is wrong for MPU6050?

Postby felixrising » Tue May 07, 2013 8:39 am

If he could make his first quad actually fly, yes... but he can't :lol:
felixrising
 
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: Gyro_scale is wrong for MPU6050?

Postby LenzGr » Mon May 20, 2013 12:22 am

ovaltineo wrote:That is correct, but I would have written it this way coz it's easier to match with the data sheet, and a compile error would alert the user that the GYRO_SCALE is not defined for the sensor:

#if defined(MPU6050)
#define GYRO_SCALE ((4.0f * PI)/(14.375 * 180.0f * 1000000.0f)) //(MPU6050)
#endif
#if defined(ITG3200)
#define GYRO_SCALE ((4.0f * PI)/(16.4 * 180.0f * 1000000.0f)) //(ITG3200)
#endif
#if defined(L3G4200D)
#define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f)) //(L3G4200D) this needs changes to Gyro_init and Gyro_getADC to set 2000dps and divide result by 4 instead of 20
#endif

Call me confused, but is the current code in _shared actually correct then? Or have the scaling factors between ITG3200 and MPU6050 been mixed up?
Code: Select all
#if defined(ITG3200)
  #define GYRO_SCALE (4 / 14.375 * PI / 180.0 / 1000000.0) //ITG3200   14.375 LSB/(deg/s) and we ignore the last 2 bits
#endif
#if defined(L3G4200D)
  #define GYRO_SCALE ((4.0f * PI * 70.0f)/(1000.0f * 180.0f * 1000000.0f))
#endif
#if defined(MPU6050)
  #define GYRO_SCALE (4 / 16.4 * PI / 180.0 / 1000000.0)   //MPU6050 and MPU3050   16.4 LSB/(deg/s) and we ignore the last 2 bits
#endif
User avatar
LenzGr
 
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany

Re: Gyro_scale is wrong for MPU6050?

Postby felixrising » Mon May 20, 2013 4:20 am

It was fixed in _shared on commit r1428 https://code.google.com/p/multiwii/source/detail?r=1428 with addition updates to L3G4200D in r1435 and 1439
felixrising
 
Posts: 244
Joined: Sat Mar 23, 2013 12:34 am
Location: Australia

Re: Gyro_scale is wrong for MPU6050?

Postby LenzGr » Mon May 20, 2013 3:34 pm

OK, thanks. So the values in _shared are correct, and the ones posted by ovaltineo earlier in this thread were the other way around (and wrong?)
User avatar
LenzGr
 
Posts: 166
Joined: Wed Nov 23, 2011 10:50 am
Location: Hamburg, Germany

Re: Gyro_scale is wrong for MPU6050?

Postby ovaltineo » Wed May 29, 2013 12:18 am

Yes, I got them mixed up.
ovaltineo
 
Posts: 15
Joined: Sun Apr 28, 2013 11:41 pm

Re: Gyro_scale is wrong for MPU6050?

Postby linuxslate » Fri May 31, 2013 5:42 pm

See this post for my quick and dirty backport for the "release" 2.2:

viewtopic.php?f=8&t=1591&start=20#p36799
User avatar
linuxslate
 
Posts: 91
Joined: Mon May 13, 2013 3:55 pm

Re: Gyro_scale is wrong for MPU6050?

Postby linuxslate » Fri May 31, 2013 5:42 pm

See this post for my quick and dirty backport for the "release" 2.2:

viewtopic.php?f=8&t=1591&start=20#p36799

(and tell me if anything is wrong with doing that)
User avatar
linuxslate
 
Posts: 91
Joined: Mon May 13, 2013 3:55 pm

Re: Gyro_scale is wrong for MPU6050?

Postby linuxslate » Fri May 31, 2013 6:03 pm

Sorry about the double post above, but I also have another MPU6050 possible issue/question:

The MPU6050 has both the ACCEL and the GYRO right? (Crius All in one pro V1)

Does GYRO_SCALE also affect the ACC scale?

Where is the code that sets the ACC gain? Specifically, the individual X,Y, and Z gains?

I still feel that my Z-axis accel is too sensitive.

Shaking the copter randomly and equally in 3 dimensions always produces a larger response in Z.

Also, prop vibrations show up more in the Z axis than in X or Y (Which are IMHO incorrectly marked as ROLL and PITCH in MultiWiiConf. GYRO is ROLL and PITCH, but ACC should be X and Y). Logically, one would expect a prop imbalance (in a Quad) to create significantly more X,Y vibrations, while only showing up a bit in Z.

This is causing prop vibrations to result in vertical surging, while ROLL and PITCH are solid as a rock.

I can get rid of the vertical surging by either balancing my props more carefully, or using more Low pass filter (Lower cut off value), but I think a better fix would be to reduce the influence of the Z axis accel.

I'd like to try reducing my ACC (Not GYRO) gains individually, but I do not know where in the code to do this.
User avatar
linuxslate
 
Posts: 91
Joined: Mon May 13, 2013 3:55 pm

Re: Gyro_scale is wrong for MPU6050?

Postby Alexinparis » Sun Jun 02, 2013 6:29 pm

linuxslate wrote:The MPU6050 has both the ACCEL and the GYRO right? (Crius All in one pro V1)

yes


Does GYRO_SCALE also affect the ACC scale?

no

Where is the code that sets the ACC gain? Specifically, the individual X,Y, and Z gains?

in IMU.ino
there is no individual X/Y/Z setting

Shaking the copter randomly and equally in 3 dimensions always produces a larger response in Z.

that should not be the case

Also, prop vibrations show up more in the Z axis than in X or Y (Which are IMHO incorrectly marked as ROLL and PITCH in MultiWiiConf. GYRO is ROLL and PITCH, but ACC should be X and Y). Logically, one would expect a prop imbalance (in a Quad) to create significantly more X,Y vibrations, while only showing up a bit in Z.

I think the effect of unbalanced motors or propellers is hard to predict.
The frequency is high, and frame resonance effects could lead to other axis perturbation.
Alexinparis
 
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Gyro_scale is wrong for MPU6050?

Postby scrat » Tue Jun 11, 2013 10:50 am

@Alexinparis:

I have mwii v2.2 and I have set in EEPROM.ino for stick scalling: 2*...code below.

for(i=0;i<6;i++) {
lookupPitchRollRC[i] = 2* (2500+conf.rcExpo8*(i*i-25))*i*(int32_t)conf.rcRate8/2500;

I know there is fix for gyro scale in new dev code. With gyro scale fixed, can I still set 2* for better stick response?

Thanks!
scrat
 
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Gyro_scale is wrong for MPU6050?

Postby Alexinparis » Thu Jun 13, 2013 10:14 pm

scrat wrote:@Alexinparis:

I have mwii v2.2 and I have set in EEPROM.ino for stick scalling: 2*...code below.

for(i=0;i<6;i++) {
lookupPitchRollRC[i] = 2* (2500+conf.rcExpo8*(i*i-25))*i*(int32_t)conf.rcRate8/2500;

I know there is fix for gyro scale in new dev code. With gyro scale fixed, can I still set 2* for better stick response?

Thanks!


this tweak still works and is independent with gyro scale.
you can also raise your rc rate
Alexinparis
 
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Gyro_scale is wrong for MPU6050?

Postby scrat » Fri Jun 14, 2013 10:56 am

Thanks.

I'm using this tweak and rc rate set to 1.50 since I bought AIO pro. Because I'm used to have more response from quad.
scrat
 
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: Gyro_scale is wrong for MPU6050?

Postby Shanthosh Ravikumar » Thu Dec 12, 2013 4:58 pm

hey all !!
I am new to this forum and a first time user of Multiwii ( Nanowii)
and i am having an error when i compile the firmware in arduino..
the error is shown like this
"IMU.cpp: In function 'void getEstimatedAttitude()':
IMU.cpp:189: error: 'GYRO_SCALE' was not declared in this scope "

I have no idea about this error ... and I dont know how to correct this
can anyone please help me ???

Thanks in advance :)
Shanthosh Ravikumar
 
Posts: 1
Joined: Wed Dec 11, 2013 8:09 pm

Re: Gyro_scale is wrong for MPU6050?

Postby err888 » Fri Dec 13, 2013 11:20 am

Shanthosh Ravikumar wrote:hey all !!
I am new to this forum and a first time user of Multiwii ( Nanowii)
and i am having an error when i compile the firmware in arduino..
the error is shown like this
"IMU.cpp: In function 'void getEstimatedAttitude()':
IMU.cpp:189: error: 'GYRO_SCALE' was not declared in this scope "

I have no idea about this error ... and I dont know how to correct this
can anyone please help me ???

Thanks in advance :)

Have you uncommented a specific board type or independent sensors in config.h, and which ones have you uncommented?

Kenny
User avatar
err888
 
Posts: 16
Joined: Mon Jul 22, 2013 9:31 am


Return to Software development

Who is online

Users browsing this forum: No registered users and 3 guests