WVCFreelancer Posted May 21, 2014 Report Share Posted May 21, 2014 I'm writing code in Python onto a Raspberry Pi. I'm pulling gyro data well enough, it seems, but I'm attempting to write sensor fusion code for this device--which is rather new to me--so I'm trying to use the magnetometer also. I'm getting rather desperate to find out how to use this device because currently its output does respond to its position but is extremely erratic, even at rest, and the values are not very large (>250) and vary wildly. I cannot imagine how I could possibly use it to determine bearing with the way it is currently outputting data. I found a paper with formulas for sensor fusion but this is a major impasse at the moment. Quote Link to comment Share on other sites More sharing options...
robjames66 Posted June 17, 2014 Report Share Posted June 17, 2014 It sucks doesn't it! Much worse than a HMC5883 A simple low pass filter helps. If x,y hold the raw values and xf,yf are global floats: xf = xf - (xf / 24) + (float)x/180.0; yf = yf - (yf / 24) + (float)y/180.0; // not tilt compensated... heading = atan2(xf / 24, yf / 24); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.