-
Notifications
You must be signed in to change notification settings - Fork 151
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
Unable to get raw accelerometer data after calculating quaternion #39
Comments
I am with the same problem... if anyone could help us I would appreciate it |
I got it to work with both DMP FiFo AND mag values by initializing like this: if (imu.begin() != INV_SUCCESS)
{
while (1)
{
Serial.println("Unable to communicate with MPU-9250");
Serial.println("Check connections, and try again.");
Serial.println();
delay(5000);
}
}
imu.dmpBegin(DMP_FEATURE_6X_LP_QUAT | // Enable 6-axis quat
DMP_FEATURE_GYRO_CAL | // Use gyro calibration
DMP_FEATURE_SEND_RAW_ACCEL | // Send raw accelerometer values to FIFO
DMP_FEATURE_SEND_RAW_GYRO, // Send raw gyroscope values to FIFO
10); // Set DMP FIFO rate to 10 Hz
// Enable all sensors:
imu.setSensors(INV_XYZ_GYRO | INV_XYZ_ACCEL | INV_XYZ_COMPASS);
// Likewise, the compass (magnetometer) sample rate can be
// set using the setCompassSampleRate() function.
// This value can range between: 1-100Hz
imu.setCompassSampleRate(10); // Set mag rate to 10Hz and then in my loop I read the data like this if (imu.dataReady())
{
imu.update(UPDATE_COMPASS);
}
// Check for new data in the FIFO
if (imu.fifoAvailable())
{
// Use dmpUpdateFifo to update the ax, gx, mx, etc. values
if (imu.dmpUpdateFifo() == INV_SUCCESS)
{
// computeEulerAngles can be used -- after updating the
// quaternion values -- to estimate roll, pitch, and yaw
imu.computeEulerAngles();
}
}
Serial.printf("FLOAT:\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\t%.2f\n",
imu.calcAccel(imu.ax), imu.calcAccel(imu.ay), imu.calcAccel(imu.az),
imu.calcGyro(imu.gx), imu.calcGyro(imu.gy), imu.calcGyro(imu.gz),
imu.calcMag(imu.mx), imu.calcMag(imu.my), imu.calcMag(imu.mz));
Serial.printf("Roll: %.2f\tPitch: %.2f\tYaw: %.2f\n",
imu.roll,
imu.pitch,
imu.yaw); |
Thank you very much, I will be testing this soon! :D |
Weird. My above solution worked perfectly with a nRF52832 Feather board and a ESP32 Feather board, but fails on my custom board with an Insight ISP4520 (Nordic nRF52832 + Semtech SX1262 LoRa transceiver). |
Thanks! Please let me know |
Hello, I am facing a problem getting raw accelerometer data. I need to substract the gravity from my raw accel data,so I am calculating my quaternions with DPM. My code is the following
Im using the DPM Quaternion example and made those modifications, but my ax, ay and Az values are zero. The main loop it's exactly the one from the example, I only removed the call to computeEulerAngles() because I do not need it. I think Im not understanding exactly how to get the raw data, because the basic example is different, also I know understand that the dpm code utilizes a FIFO Buffer to store the data. I need to get the raw AY,AY and AZ values that were used to calculate the quaternion. Am I doing something wrong?
Thank you
The text was updated successfully, but these errors were encountered: