IMU based on lsm9ds1 9DOF Mems chip and Madgwick quaternion filtering
Rayman
Posts: 14,662
in Propeller 2
I think I finally have this working!
It is mostly in the the fastspin's C, although the i2c is done by @JonnyMac's Spin2 driver.
The trick to getting yaw working was to calibrate the magnetic sensor. This is a bit of a pain.
Accelerometer and Gyro can be calibrated by just holding the device steady.
But, the magnetometer has to be calibrated by feeding the data while moving the sensor every which way to an external program.
Here, I'm using Magneto 1.2 program to do this. Adafruit shows a nicer looking way, but I wasn't able to make that work.
This code is using the quasi-standard Madgwick filter to process the input data into a filtered yaw, pitch, and roll output.
Here's the code:
It is mostly in the the fastspin's C, although the i2c is done by @JonnyMac's Spin2 driver.
The trick to getting yaw working was to calibrate the magnetic sensor. This is a bit of a pain.
Accelerometer and Gyro can be calibrated by just holding the device steady.
But, the magnetometer has to be calibrated by feeding the data while moving the sensor every which way to an external program.
Here, I'm using Magneto 1.2 program to do this. Adafruit shows a nicer looking way, but I wasn't able to make that work.
This code is using the quasi-standard Madgwick filter to process the input data into a filtered yaw, pitch, and roll output.
Here's the code:
Comments
Do you have a link to Magneto 1.2 ? I get very old links with a Google search.
Here's my instructions for using magneto from the code:
Have you tried the BNO055?
Its can do the fusion for you, (apparently)
Dave
About the same price.
Modules with it are twice as expensive for some reason looks like...