Hi all,
I’am using this algorithm Arduino madgwick but I have a question about begin method.
In the example code we have 25, what is the meaning of this number? 25Hz? This is mean I need to call updateIMU() in my loop every 40ms (25Hz) ?
Hi all,
I’am using this algorithm Arduino madgwick but I have a question about begin method.
In the example code we have 25, what is the meaning of this number? 25Hz? This is mean I need to call updateIMU() in my loop every 40ms (25Hz) ?
Could you tell what example and which begin ?
This is an example for the retired Arduino 101: Visualize101.ino.
The CurieIMU library is only for the Arduino 101.
The setGyroRate() and setAccelerometerRate() set the rate in samples per second.
In the example, the interval is set as: microsPerReading = 1000000 / 25
That is indeed 40 ms.
Yes I’am talking about visialize101. So if I understand well, in general, (I don’t use curieIMU) if I have new data coming from a captor at 200Hz frequency, I should set filter.begin with 200 am’I right?
Yes, the filter.begin() uses the sample frequency as parameter as you can see here.
I can't find any documentation either
so I had to look in the source code.
This seems to be the original paper: https://www.x-io.co.uk/res/doc/madgwick_internal_report.pdf
Great thanks for the paper is very usefull
. I've something that I don't understand. If I set my filter with a frequency at 100Hz for example, wich mean I have new data coming from my captor at 100Hz and I update my algorithm at the same time, the madgwick algorithm is very slow to change, I have better result if I set my filter to 5Hz for example is it normal? it should be the opposite, right ? More the frequency is, faster algorithm should be change my values no?
The filter output values will change only if the sensor data values are changing. The sample frequency has little to do with that.
Please explain what you mean by "the madgwick algorithm is very slow to change".
For example in my loop I got new value from my captor every 10ms (100Hz), so I put 100 in parameter at begin method.
But if I move my captor Madgwick algorithm is very slow to show me changed value, I need to put filter.begin at 10 if I want reactive value... I don't understand why...
My captor is set with data rate for gyro and accel at 104Hz, my loop call my captor every 10ms and updateIMU just after I reclaimed new data from my captor.
I do not understand what you mean. Post your code, using code tags, and post an example of the output.
Explain what you expect to happen, and what happens instead.
Ok so firt in my setup function I initialize my captor,
Madgwick filter;
setup(){
.... other lines
my_captor.setAccelDataRate(MASK_104HZ); //mask provided by adafruit
my_captor.setGyroDataRate(MASK_104HZ);
filter.begin(100); // for 100Hz
.... other lines
t_start = millis();
}
In my loop
loop(){
//check if 10ms has passed
if( millis() - t_start >= 10 ){
t_start = millis();
//here I get data from my captor, this is adafruit library LSM6DSO32 captor
my_captor.getEvent(&accel_dso, &gyro_dso, &temp_dso);
filter.updateIMU( gyro_dso.gyro.x, gyro_dso.gyro.y, gyro_dso.gyro.z, accel_dso.acceleration.x, accel_dso.acceleration.y, accel_dso.acceleration.z);
//print quaternion values
Serial.print(q0);
Serial.print(q1);
Serial.print(q2);
Serial.print(q3);
}
}
My problem is where I printed value, if I set my filter with 100 in begin function, value take time to be updated average 2second, but if I set my filter at 10 for example everything works my values are updated faster, I don't understand why, beceause in my loop I check time with millis.
Specially I don't understand why if I reduce frequency in begin function of my filter my value are update faster, it's not logic for me, higer frequency faster update no?
Post ALL the code.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.