-
Notifications
You must be signed in to change notification settings - Fork 73
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
Create Example11_DMP_Gravity_Oriented_Accelerometer.ino #73
base: release_candidate
Are you sure you want to change the base?
Create Example11_DMP_Gravity_Oriented_Accelerometer.ino #73
Conversation
As discussed with @PaulZC, this file rotates the raw accelerometer data using the Quat6 quaternion. An intialisation finds "down" and this is stored to allow the sensor to orient so that reported acceleration values are Up/Down, "N/S" and "E/W" in the external world frame. I've set the sensor scale to 16g; if these values are exceeded then the quaternion loses it's lock. There is a routine that can be enabled to continuously correct the sensor to re-find gravity, but this is disabled by default. I wrote this using an openlog artermis but it should be device independent - any issues, please let me know! Jon
Hi Jon, This is brilliant stuff! Sincere thanks for submitting this. Your code looks great and I'm delighted it is working well for you. But I'm also slightly puzzled too...: Lines 323 to 324 in 486fdbf
And in your example I see you are using low power mode (how it was in v1.2.5): So I'm utterly confused. (Not for the first time - especially where the DMP is concerned!) I'm guessing that your code actually compensates for the 'drift' we were seeing in v1.2.5? Just to put my mind at rest, could you please try having the accel and gyro not in low power mode? Does that make any difference to how your code behaves? I am going to merge your example, absolutely no issue there, but maybe you could test this before I do? Thanks again, |
Paul, Sure, not a problem - I updated the Arduino library to version 1.2.6 but obviously was still using the example 10 from version 1.2.5 as the base file for my tests. I'll try and get a free moment this week to plug it back in and make the changes. Jon |
Hey @PaulZC, Sorry for the delays. I've checked the low power mode and it all seems to work out. I also noticed an error in the acceleration values from going to 16g, and have made a couple of changes that means that the code now seems to work with Quat9 (which should give a more stable heading when the gravity correction is enabled). Is there a way to modify the pull request, or should I start a new one with the modified code? Jon |
Hi Jon (@higherstateofawkwardness ), Sincere thanks for this. You can just add your changes to this PR. Please just commit and push the changes to your patch-1 branch and they should appear here ready for merging. Thanks again, |
@higherstateofawkwardness - Would you be able to push your latest changes onto your 'patch-1' branch? I would like to use the latest version of this example for my project, thanks! |
As discussed with @PaulZC, this file rotates the raw accelerometer data using the Quat6 quaternion. An intialisation finds "down" and this is stored to allow the sensor to orient so that reported acceleration values are Up/Down, "N/S" and "E/W" in the external world frame.
I've set the sensor scale to 16g; if these values are exceeded then the quaternion loses it's lock. There is a routine that can be enabled to continuously correct the sensor to re-find gravity, but this is disabled by default.
There is a new function in there (findgravity) that I haven't highlighted in the keywords.txt; I also changed the readIMUDMP to returning a value so that this can be used for flow control within the main loop and decide whether to wait or continue to read more values. I wrote this using an openlog artermis but it should be device independent - any issues, please let me know!
Jon