Skip to content
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

Quaternion DMP calulation not working on Mega 2560 #22

Open
raomin opened this issue Jul 31, 2018 · 9 comments
Open

Quaternion DMP calulation not working on Mega 2560 #22

raomin opened this issue Jul 31, 2018 · 9 comments

Comments

@raomin
Copy link

raomin commented Jul 31, 2018

I ran MPU9250_DMP_Quaternion.ino without any problem on an ESP8266.
Now I want to use it on a Arduino Mega 2560 and it returns the following:

Q:    INF,    INF,    INF,    INF
R/P/Y:  NAN, 180.00,  NAN
Time: 32761 ms

MPU9250_DMP_Gyro_Cal.ino works correctly on the same Arduino Mega 2560.

I tried DMP_FEATURE_6X_LP_QUAT and DMP_FEATURE_LP_QUAT both gives the same.

Also, dmpBegin returns INV_SUCCESS.

I also tried with Wire.setClock(400000), no success...

Any idea what could cause this issue?

@kolosy
Copy link

kolosy commented Aug 1, 2018

I'm actually running into the same exact issue (same mcu, too). Still debugging, but my hunch is that it's the function that converts the quaternion values from integer math to floats. The raw values seem legit, but go to INF after the call to qToFloat()

@kolosy
Copy link

kolosy commented Aug 1, 2018

Yeah, confirmed. I'll try to get a PR open when I have a minute, but edit MPU9250_DMP::qToFloat and change the integer literals from 1 and 2 to 1L and 2L, respectively. That got it working for me.

@raomin
Copy link
Author

raomin commented Aug 1, 2018

Good spot! It does return some values now... but the values are weird:
0.5847,2.2581,2.6837,2.9126

Values should stay within [-1,1] and it's not just off by +2... Do you observe the same in your setup?
seems related to #15

@kolosy
Copy link

kolosy commented Aug 9, 2018

I don't see that on mine.. not sure how it's different from yours

@pradeep8892
Copy link

Hello everyone. I am also facing the same issue. DId anyone get the solution

@marcoarnold99
Copy link

Yeah, confirmed. I'll try to get a PR open when I have a minute, but edit MPU9250_DMP::qToFloat and change the integer literals from 1 and 2 to 1L and 2L, respectively. That got it working for me.

Hey kolosy
Just wanted to say thank you. I've been looking for a way to read this IMU for about 1 month now. With your solution everything works.
Thank you so much and have a great day ^^

@raomin
Copy link
Author

raomin commented May 14, 2019

I'll close this issue as @kolosy found a solution for the NAN.

@raomin raomin closed this as completed May 14, 2019
@kolosy
Copy link

kolosy commented May 14, 2019

@raomin I'd recommend keeping it open until it's actually fixed in the codebase...

@raomin
Copy link
Author

raomin commented May 14, 2019

good point.

@raomin raomin reopened this May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants