Comments (5)
from esp32.
from esp32.
Its done, I have used your MPU9250BasicAHRS. Just a few changes in order to work.
The output:
14:38:43.685 -> MPU9250 I AM 71 I should be 71 14:38:44.694 -> MPU9250 is online... 14:38:45.487 -> x-axis self test: acceleration trim within : 1.0% of factory value 14:38:45.487 -> y-axis self test: acceleration trim within : 0.3% of factory value 14:38:45.521 -> z-axis self test: acceleration trim within : 2.7% of factory value 14:38:45.521 -> x-axis self test: gyration trim within : 46.1% of factory value 14:38:45.521 -> y-axis self test: gyration trim within : 7.8% of factory value 14:38:45.521 -> z-axis self test: gyration trim within : 0.8% of factory value 14:38:47.360 -> MPU9250 initialized for active data mode.... 14:38:47.360 -> AK8963 I AM 48 I should be 48 14:38:48.403 -> AK8963 initialized for active data mode.... 14:38:48.403 -> X-Axis sensitivity adjustment value 1.18 14:38:48.403 -> Y-Axis sensitivity adjustment value 1.19 14:38:48.403 -> Z-Axis sensitivity adjustment value 1.14 14:38:49.414 -> ax = -66.96 ay = 1.77 az = 933.72 mg 14:38:49.414 -> gx = -0.07 gy = 0.02 gz = -0.08 deg/s 14:38:49.414 -> mx = -323 my = 134 mz = -658 mG 14:38:49.414 -> q0 = 0.06 qx = 0.81 qy = -0.39 qz = 0.43 14:38:49.414 -> Yaw, Pitch, Roll: -74.15, -48.31, -159.46 14:38:49.414 -> rate = 0.15 Hz 14:38:49.902 -> ax = -67.69 ay = 2.08 az = 934.20 mg 14:38:49.902 -> gx = -0.08 gy = 0.05 gz = 0.02 deg/s 14:38:49.902 -> mx = -324 my = 132 mz = -639 mG 14:38:49.902 -> q0 = 0.92 qx = 0.03 qy = -0.06 qz = 0.38 14:38:49.936 -> Yaw, Pitch, Roll: 30.57, -7.37, 1.03 14:38:49.936 -> rate = 1062.95 Hz 14:38:50.425 -> ax = -63.84 ay = 0.98 az = 935.91 mg 14:38:50.425 -> gx = -0.14 gy = -0.02 gz = -0.01 deg/s 14:38:50.425 -> mx = -323 my = 148 mz = -644 mG 14:38:50.425 -> q0 = 0.88 qx = 0.01 qy = 0.01 qz = 0.47 14:38:50.425 -> Yaw, Pitch, Roll: 42.84, 0.47, 2.09 14:38:50.425 -> rate = 1065.36 Hz 14:38:50.913 -> ax = -64.51 ay = -0.79 az = 935.12 mg 14:38:50.913 -> gx = -0.15 gy = 0.02 gz = 0.03 deg/s 14:38:50.948 -> mx = -335 my = 132 mz = -670 mG 14:38:50.948 -> q0 = 0.85 qx = -0.00 qy = 0.02 qz = 0.53 14:38:50.948 -> Yaw, Pitch, Roll: 49.87, 1.83, 1.06 14:38:50.948 -> rate = 1066.25 Hz 14:38:51.436 -> ax = -67.14 ay = 0.49 az = 933.53 mg 14:38:51.436 -> gx = -0.13 gy = 0.12 gz = -0.02 deg/s 14:38:51.436 -> mx = -330 my = 141 mz = -644 mG 14:38:51.436 -> q0 = 0.83 qx = -0.01 qy = 0.02 qz = 0.56 14:38:51.436 -> Yaw, Pitch, Roll: 54.69, 2.65, 0.58 14:38:51.436 -> rate = 1068.53 Hz 14:38:51.946 -> ax = -64.39 ay = -0.24 az = 939.09 mg
Now I have some doubts about the mag calibration, I was looking in this issue:
kriswiner/MPU9250#50
However the MPU9250BaiscAHRS is really different when I compare with the example that you give to us:
https://github.com/kriswiner/MPU-9250/blob/master/MPU9250_MS5637_AHRS_t3.ino
For example I dont even had this function magcalMPU9250() in the example. And I found this lines, that I'm not sure, but I think they are bias values, as we can find in the gyro.
readMagData(magCount); // Read the x/y/z adc values getMres(); magbias[0] = +470.; // User environmental x-axis correction in milliGauss, should be automatically calculated magbias[1] = +120.; // User environmental x-axis correction in milliGauss magbias[2] = +125.; // User environmental x-axis correction in milliGauss
Could you just give me some tips How can I ajust for my own sensor?
from esp32.
from esp32.
Thank you, that's what I undestood reading your code. Now I'm worried how can I get my magbias[].
Using this function:
`void magcalMPU9250(float * dest1, float * dest2)
{
uint16_t ii = 0, sample_count = 0;
int32_t mag_bias[3] = {0, 0, 0}, mag_scale[3] = {0, 0, 0};
int16_t mag_max[3] = {0xF000, 0xF000, 0xF000}, mag_min[3] = {0x7FFF, 0x7FFF, 0x7FFF}, mag_temp[3] = {0, 0, 0};
Serial.println("Mag Calibration: Wave device in a figure eight until done!");
delay(4000);
sample_count = 128;
for(ii = 0; ii < sample_count; ii++) {
MPU9250readMagData(mag_temp); // Read the mag data
for (int jj = 0; jj < 3; jj++) {
if(mag_temp[jj] > mag_max[jj]) mag_max[jj] = mag_temp[jj];
if(mag_temp[jj] < mag_min[jj]) mag_min[jj] = mag_temp[jj];
}
delay(135); // at 8 Hz ODR, new mag data is available every 125 ms
}
// Get hard iron correction
mag_bias[0] = (mag_max[0] + mag_min[0])/2; // get average x mag bias in counts
mag_bias[1] = (mag_max[1] + mag_min[1])/2; // get average y mag bias in counts
mag_bias[2] = (mag_max[2] + mag_min[2])/2; // get average z mag bias in counts
dest1[0] = (float) mag_bias[0]_MPU9250mRes_MPU9250magCalibration[0]; // save mag biases in G for main program
dest1[1] = (float) mag_bias[1]_MPU9250mRes_MPU9250magCalibration[1];
dest1[2] = (float) mag_bias[2]_MPU9250mRes_MPU9250magCalibration[2];
// Get soft iron correction estimate
mag_scale[0] = (mag_max[0] - mag_min[0])/2; // get average x axis max chord length in counts
mag_scale[1] = (mag_max[1] - mag_min[1])/2; // get average y axis max chord length in counts
mag_scale[2] = (mag_max[2] - mag_min[2])/2; // get average z axis max chord length in counts
float avg_rad = mag_scale[0] + mag_scale[1] + mag_scale[2];
avg_rad /= 3.0;
dest2[0] = avg_rad/((float)mag_scale[0]);
dest2[1] = avg_rad/((float)mag_scale[1]);
dest2[2] = avg_rad/((float)mag_scale[2]);
Serial.println("Mag Calibration done!");
}`
Should I use dest1 or dest2? or none of them ? in orderm to replace your values. I ll try to adapt this calibration fucntion in your example MPU9250BaiscAHRS. Another point is, I didnt find any place to set my coordenate (location). Is that alright?
from esp32.
Related Issues (20)
- Esp32_arduino_wifierror HOT 1
- Esp32 compiling guide HOT 2
- Yaw resets to previous value HOT 6
- esp32 mpu9250 HOT 15
- general esp32 / mpu question HOT 6
- Problem gyro bias HOT 5
- Which is better to use for ESP32 and Sparkfun 9250 breakout? HOT 25
- angle offset to 0 HOT 36
- Problem with Roll,pith and yaw HOT 5
- Is esp32 fast enough for ahrs using magwick or ekf HOT 2
- Is the rate calculation correct? HOT 1
- What is the best value for pull up resistance on SDA and SCL for MPU9250 when used with ESP32 HOT 1
- Is a WHO_AM_I response of "0x70" a sure sign of a MPU6500? HOT 3
- Image HOT 3
- Can not upload sketches HOT 4
- WiFi Example: HOT 9
- Question on Switching Wire Library to i2c_t3 HOT 2
- Not Issue Just Info on boards.txt
- failed to load bootloader header! error with new esp32 lib/ide 1.8.2 HOT 36
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp32.