-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
madgwick filter #419
Comments
This <https://github.com/kriswiner/MPU9250/tree/master/AK8963_as_slave>
sketch has methods that work well for this.
…On Mon, Jun 1, 2020 at 5:53 AM 29676 ***@***.***> wrote:
Hi
I have a question about how to filter mpu9250 data. I read the raw data of
the sensor, but I had trouble getting Quaternion. The output q is unstable
at all, and the data of the roll, pitch, and yaw I obtained are constantly
increasing. Most likely they are wrong. How can I solve this problem? If
you can help, thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#419>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKQP74FPX22FB3MOEYTRUOQE7ANCNFSM4NPZNKGQ>
.
|
Thanks for the response. I wrote the program with atmega32 and in codvision , and to do this I repeated the madgwick filter 100 times using the loop, then I printed q. Outputs are constantly increasing or decreasing and not stable . Can uncalibrated data cause quaternion unstability? I have listed quaternion data below . thanks for your help. q0=0.952220, q1=-0.100866, q2=-0.100129, q3=-0.264017 |
Yes, you have to calibrate your sensors other wise you will get garbage
output.
…On Tue, Jun 2, 2020 at 12:11 AM 29676 ***@***.***> wrote:
Thanks for the response. I wrote the program with atmega32 and in
codvision , and to do this I repeated the madgwick filter 100 times using
the loop, then I printed q. Outputs are constantly increasing or decreasing
and not stable . Can uncalibrated data cause quaternion unstability? I have
listed quaternion data below .
This data is in a position where the sensor is fixed and has no movement.
thanks for your help.
q0=0.952220, q1=-0.100866, q2=-0.100129, q3=-0.264017
q0=0.946733, q1=-0.103507, q2=-0.101369, q3=-0.281663
q0=0.941104, q1=-0.105357, q2=-0.102238, q3=-0.298993
q0=0.935290, q1=-0.106757, q2=-0.102158, q3=-0.316268
q0=0.929400, q1=-0.107310, q2=-0.102020, q3=-0.333046
q0=0.923336, q1=-0.107924, q2=-0.101661, q3=-0.349420
q0=0.917256, q1=-0.107638, q2=-0.100741, q3=-0.365423
q0=0.911033, q1=-0.107042, q2=-0.099944, q3=-0.381050
q0=0.904832, q1=-0.106224, q2=-0.098741, q3=-0.396071
q0=0.898601, q1=-0.105470, q2=-0.097243, q3=-0.410565
q0=0.892194, q1=-0.104208, q2=-0.095513, q3=-0.425011
q0=0.885881, q1=-0.102844, q2=-0.093752, q3=-0.438720
q0=0.879550, q1=-0.101485, q2=-0.091820, q3=-0.451984
q0=0.873104, q1=-0.099661, q2=-0.090195, q3=-0.465026
q0=0.866777, q1=-0.097886, q2=-0.088298, q3=-0.477438
q0=0.860479, q1=-0.096014, q2=-0.086519, q3=-0.489385
q0=0.854239, q1=-0.094317, q2=-0.085004, q3=-0.500781
q0=0.848075, q1=-0.092283, q2=-0.083003, q3=-0.511849
q0=0.842057, q1=-0.090524, q2=-0.081202, q3=-0.522283
q0=0.836008, q1=-0.088794, q2=-0.079476, q3=-0.532463
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKWWOZGLDYUM5RVSGVLRUSQ2JANCNFSM4NPZNKGQ>
.
|
Should I enable fifo to calibrate the sensor or can it be calibrated without fifo? |
either way
…On Tue, Jun 2, 2020 at 8:55 AM 29676 ***@***.***> wrote:
Should I enable fifo to calibrate the sensor or can it be calibrated
without fifo?
Thank you
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKQBI2KQQADTVCH7GUDRUUOF3ANCNFSM4NPZNKGQ>
.
|
I have a few questions |
" help me calibrate the sensor."
See sketches in the repository.
Madgick filter should be iterated 10 - 20 times per new data set, again,
see sketches, such as here
<https://github.com/kriswiner/MPU9250/tree/master/AK8963_as_slave>.
…On Tue, Jun 2, 2020 at 10:42 AM 29676 ***@***.***> wrote:
I have a few questions
I get compass data in two ways, but I don't know if they're right, how can
I be sure?
And for the madgwick filter, how many times should the loop be repeated to
make the correct outputs?
If possible, help me calibrate the sensor.
Does the madgwick filter give stable outputs or Kalman? which one is
better?
How to get GyroMeasError values, and
GyroMeasDrift?
Thank you for your help
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKRMGYFURUXS2PLQAD3RUU2ZPANCNFSM4NPZNKGQ>
.
|
Hi , MPU9250.readMagData(magCount);
} |
Which main program are you using?
…On Wed, Jun 3, 2020 at 9:03 AM 29676 ***@***.***> wrote:
Hi ,
Thanks a lot for the response,
I have a problem with the calibration function
Do you get the values of magBias and magscale from the magcalMPU9250
function?
values of magCount (in the following function that is inside the main
program) are raw data or the outputs of the magcalMPU9250 function?
MPU9250.readMagData(magCount);
mx = (float)magCount[0]*mRes*magCalibration[0] - magBias[0];
my = (float)magCount[1]*mRes*magCalibration[1] - magBias[1];
mz = (float)magCount[2]*mRes*magCalibration[2] - magBias[2];
mx *= magScale[0];
my *= magScale[1];
mz *= magScale[2];
}
And another question, where is the output of the magcalMPU9250 function
used in the main program ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKTSNBAZLHSK75RN4Q3RUZX6RANCNFSM4NPZNKGQ>
.
|
In this program, that madgwick filter is called and the roll, pitch and yaw are also calculated |
line 159
…On Wed, Jun 3, 2020 at 9:58 AM 29676 ***@***.***> wrote:
In this program, that madgwick filter is called and the roll, pitch and
yaw are also calculated
AK8963Slave0_MPU9250_Ladybug.ino
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKQSROBTJKVN5Q2Y62LRUZ6LZANCNFSM4NPZNKGQ>
.
|
So the values of magbias and mag scale (in The following function) are obtained from the magcalMPU9250 function. MPU9250.readMagData(magCount);
|
yes
…On Wed, Jun 3, 2020 at 10:30 AM 29676 ***@***.***> wrote:
So the values of magbias and mag scale (in The following function) are
obtained from the magcalMPU9250 function.
And mag count[0] ,mag count[1] , mag count[2] are raw values magnet that
get than readMagData function . it's true?
MPU9250.readMagData(magCount);
mx = (float)magCount[0]*mRes*magCalibration[0] - magBias[0]; // get actual magnetometer value, this depends on scale being set
my = (float)magCount[1]*mRes*magCalibration[1] - magBias[1];
mz = (float)magCount[2]*mRes*magCalibration[2] - magBias[2];
mx *= magScale[0];
my *= magScale[1];
mz *= magScale[2];
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKV3AK627APEKI4AMSDRU2CBDANCNFSM4NPZNKGQ>
.
|
Can you tell me how the values GyroMeasDrift and GyroMeas Error are obtained? Should they be calculated by testing? |
These are irrelevant.
…On Wed, Jun 3, 2020 at 11:12 AM 29676 ***@***.***> wrote:
Can you tell me how the values GyroMeasDrift and GyroMeas Error are
obtained? Should they be calculated by testing?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKRAODBN5RXDTI5GT7TRU2HAXANCNFSM4NPZNKGQ>
.
|
Sorry i don't understand. |
Not important, verify this for yourself...
…On Wed, Jun 3, 2020 at 11:27 AM 29676 ***@***.***> wrote:
Sorry i don't understand.
Does this mean that the two are fixed in all program that are used in the
filter madgwick or their value does not important?
thanks alot .
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKSZL2NLY5Y6BADELCTRU2IZXANCNFSM4NPZNKGQ>
.
|
thanks. What are the benefits of temperature values? |
calibration changes with temperature.
…On Wed, Jun 3, 2020 at 12:04 PM 29676 ***@***.***> wrote:
thanks.
Is it important to read the temperature register in sensor and also Gyro
chip temperature?
What are the benefits of temperature values?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKXYBA26HOLYU7KYAODRU2NFLANCNFSM4NPZNKGQ>
.
|
Hi kris, |
Don't need to use it. Just convenient and useful.
…On Thu, Jun 4, 2020 at 8:13 AM 29676 ***@***.***> wrote:
Hi kris,
Thank you for your help
I have a question
I don't want to use fifo. If I don't use this feature, will there be a
problem? I saw that it was used in the calibration function. Is it possible
to calibrate the sensor without it?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKU723QFVJMV2ZHGYNTRU6225ANCNFSM4NPZNKGQ>
.
|
Hi kris, I will replace this part of the code * (it,s the below) ،use loop (for (i = 0; i < 20; i += 1) ) for madgwick filter ,
and thanks a lot for your help |
This sketch uses the internal I2C bus to Tx mag data to the MPU6500 so that
all host reads are to MPU6500 registers. Tjis is best.
Bits to be written should be cleared first in such a way as not to change
the bits that are not to be written.
…On Fri, Jun 5, 2020 at 9:40 AM 29676 ***@***.***> wrote:
Hi kris,
I saw in your program that you read Magnet data in two ways , which method
is better?
and , Why the value of this register read first , then written ?
uint8_t c = readByte(MPU9250_ADDRESS, ACCEL_CONFIG2);
c = c & ~0x0F;
c = c | 0x01;
writeByte(MPU9250_ADDRESS, ACCEL_CONFIG2, c);
I will replace this part of the code * (it,s the below) ،use loop (for (i
= 0; i < 20; i += 1) ) for madgwick filter ,
Is this wrong or i can use the loop Instead of the below code?
-
Now = micros();
deltat = ((Now - lastUpdate)/1000000.0f);
lastUpdate = Now;
sum += deltat; // sum for averaging filter update rate
sumCount++;
and
the function( accelWakeOnMotion( ) )
is important?
If I don't write it, what's the problem?
thanks a lot for your help
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKRHVNSGVN3Z3JLGIQLRVENYTANCNFSM4NPZNKGQ>
.
|
Ok,thanks, |
fastest and no.
…On Fri, Jun 5, 2020 at 10:41 AM 29676 ***@***.***> wrote:
Ok,thanks,
but, why read data mag by slave is best?
and i don,t use the function (accelWakeOnMotion( ) ) is it nead?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKX46LKVHNOT2Y6VDBTRVEU3VANCNFSM4NPZNKGQ>
.
|
Hi kris ; I don't know what to do to solve the problem |
Plenty of examples in the repository to consult.
…On Thu, Jun 11, 2020 at 7:27 AM 29676 ***@***.***> wrote:
Hi kris ;
I get the raw values of the sensor correctly"
I wrote the calibration function
And I made the settings like your program,
Now that I'm running the Madgwick filter, it gives the value q0= 1 and
other quaternion to zero, which is the same initial values I've defined
for them.
I don't know what to do to solve the problem
Thank you for your help
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKTRGNOKPFNZ32VFE2TRWDSVPANCNFSM4NPZNKGQ>
.
|
In some programs I saw that the input of the filter is in the form |
1 similar comment
In some programs I saw that the input of the filter is in the form |
Read Madgwicks paper.
…On Thu, Jun 11, 2020 at 8:40 AM 29676 ***@***.***> wrote:
In some programs I saw that the input of the filter is in the form
MadgwickAHRSupdate(gx, gy, gz, ax, ay, az, mx, my, mz);
and in some it is like this:
MadgwickQuaternionUpdate(-ax, ay, az, gx*pi/180,-gy*pi/180,-gz*pi/180,
-my,mx, mz);
How do I know which one is correct?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKTEO34OMEAASXJ3OSLRWD3FFANCNFSM4NPZNKGQ>
.
|
ok ,thanks; |
No
…On Thu, Jun 11, 2020 at 9:21 AM 29676 ***@***.***> wrote:
ok ,thanks;
and if i not write self test function and not call it in main program has
problem?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKRY6JV4VVRSAUANHH3RWEAANANCNFSM4NPZNKGQ>
.
|
Hello kris ; I have a few questions:
for (ii = 0; ii < packet_count; ii++) thanks alot again |
1) I would use 400 kHz, but this alone will not cause an error. If the
fusion rate is much lower than the data sample rate, then you will get poor
results.
2) The RTC is specific to the STM32L4 and not necessary for the Madgwick
filter to work.
3) Either will do well but SPI is faster. Unless you are running the
sample rates at 8000 Hz I2C is simpler.
4) If you don;t use the FIFO you will have to rewrite this calibration
function, it is designed for FIFO use.
…On Sat, Jun 20, 2020 at 6:56 AM 29676 ***@***.***> wrote:
Hello kris ;
Thank you for your answers and help
I have a few questions:
1.
I wrote the program with mega 32 and i2c with 100k frequency. Can low
speed cause an error in the output of the madgwick filter?
2.
What is the need to use RTC in the program? If not, is there a problem?
3.
Is it better to write a program using spi or i2c?
4.
What number should I use if I didn't use fifo in this part of the
program?
instead( fifo_count)
packet_count = fifo_count/12;// How many sets of full gyro and
accelerometer data for averaging
for (ii = 0; ii < packet_count; ii++)
thanks alot again
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKS4GOOSGCQASJOGQWTRXS5XNANCNFSM4NPZNKGQ>
.
|
Thank you |
The accuracy will depend on the speed.
So you want sensor sample rate of 200 - 400 Hz abd sensor fusion rate 10x
faster. Can you MCU do this? AVRs cannot...
…On Sat, Jun 20, 2020 at 11:44 AM 29676 ***@***.***> wrote:
Thank you
So if I use i2c with 100k, the output of the madgwick function is not
wrong, only the speed is low, right?
And when I activate fifo, do I have to activate the general intrrupt for
micro?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKQB5PQRM2EUD3N47SDRXT7RVANCNFSM4NPZNKGQ>
.
|
What should I do to get a good output? |
What MCU are you using?
Might want to get one of these
<https://www.tindie.com/products/tleracorp/ladybug-stm32l432-development-board/>
.
…On Sat, Jun 20, 2020 at 12:20 PM 29676 ***@***.***> wrote:
What should I do to get a good output?
What should be the relationship between sampling rate and micro speed?
Can I get a good output with spi whit speed 1 meg? How much should I set
the spi speed to? And in this case, how much should I set the sampling rate
to?
Please help me more .thanks
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKU32PASALUUPZPJHR3RXUDYFANCNFSM4NPZNKGQ>
.
|
At mega32 |
Can't get a good output with this micro? |
8 bit, 8 MHz CPU, are you kidding? This will never work for sensor
fusion....
…On Sat, Jun 20, 2020 at 12:46 PM 29676 ***@***.***> wrote:
At mega32
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKVH2SL22K5NQPMBHDLRXUG3HANCNFSM4NPZNKGQ>
.
|
Hi kris |
8 bit 16 MHz...you are wasting your time with this...
…On Mon, Jun 22, 2020 at 7:46 PM 29676 ***@***.***> wrote:
Hi kris
What is the best amount of spi speed to be set with this 8-bit
micro(mega32) to good work sensor fusion...?
Thank you so much for your help.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKXRXE3FP3RDUP6PBJLRYAJPDANCNFSM4NPZNKGQ>
.
|
Do you mean to use other micro? |
https://www.tindie.com/products/tleracorp/ladybug-stm32l432-development-board/
Or buy a Teensy 3.2
…On Mon, Jun 22, 2020 at 8:15 PM 29676 ***@***.***> wrote:
Do you mean to use other micro?
What do you think I should do?
I don't have much experience, please help me
thanks
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKUEFC4T6UOGRKSWI2TRYAM3ZANCNFSM4NPZNKGQ>
.
|
Ok thanks Mr Kris; |
The fusion rate needs to be 10 - 20x the gyro sample rate, the gyro sample
rate is typically 200- 400 Hz for the MPU9250, so the MPU needs to be able
to iterate the Madgwick solution 10 - 20 times for every new gyro sample.
An 8 bit, 8 MHz AVR MCU cannot do this, best
<https://github.com/kriswiner/MPU6050/wiki/Affordable-9-DoF-Sensor-Fusion>that
it can do is ~100 Hz fusion rate.
…On Tue, Jun 23, 2020 at 12:06 AM 29676 ***@***.***> wrote:
Ok thanks Mr Kris;
But what is the reason that this micro is not suitable for this job?
Because of speed?
Or accuracy?
Or filter?
Or not stable output filter?
Roll and pitch and yaw obtained by this method
Not valid?
Thanks alot again for your answers and your help.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKTHNOWQYLJASEO2VWTRYBH7RANCNFSM4NPZNKGQ>
.
|
Hello Kris; |
Why do you need a Mic?
…On Mon, Jul 20, 2020 at 7:19 AM 29676 ***@***.***> wrote:
Hello Kris;
Thank you very much for your help ;
I want to use stm32 for mpu9250 ;
Is it needed another tools ، besides Mic for this job?
Should I use special board/Piece for calibration ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKX4SYIGO6COLZEOOYDR4RG6DANCNFSM4NPZNKGQ>
.
|
I mean, other than Mcu stm32, do I need another board or device for get output and calibration sensor? |
You need an STM32 development board and an MPU9250 breakout board. I
recommend this
<https://www.tindie.com/products/tleracorp/ladybug-stm32l432-development-board/>
and this
<https://www.tindie.com/products/tleracorp/mpu9250-add-ons-for-ladybug/>.
The MPU9250 breakout mounts directly on top or bottom of the Ladybug; this
is all you need for reasonably accurate AHRS.
…On Mon, Jul 20, 2020 at 9:18 AM 29676 ***@***.***> wrote:
I mean, other than Mcu stm32, do I need another board or device for get
output and calibration sensor?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#419 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTDLKR3M7KE4TL6ZLFX6ADR4RU35ANCNFSM4NPZNKGQ>
.
|
Hi
I have a question about how to filter mpu9250 data. I read the raw data of the sensor, but I had trouble getting Quaternion. The output q is unstable at all, and the data of the roll, pitch, and yaw I obtained are constantly increasing. Most likely they are wrong. How can I solve this problem? If you can help, thanks
The text was updated successfully, but these errors were encountered: