# Dynamic Gyro/Accelerometer Pitch and Roll with a Kalman Filter

1. May 11, 2012

### GSci

Hello,

I am trying to implement a kalman filter to process data from three gyros (x, y, z) and three accelerometers (x, y, z) to get dynamic pitch and roll data. I am new to the subject, just started learning about kalman filters last week. I got the filter implemented in mathematica and it is putting out what looks like good data, except that when compared to data from an already implemented complementary filter the variation in pitch and roll are about an order of magnitude smaller in the kalman filter's output. That is to say, the data matches up really well, it is just that the difference between the highest and lowest values of pitch/roll out of the kalman filter are about an order of magnitude less.

I am using the pitch, roll, and an initially undetermined constant drift as my state vector, and the gyros as control inputs.

I thought I was putting too much weight into the accelerometer data so I pumped up the values in the measurement covariance matrix (R), and played with the state-space evolution noise (Q). Initially I had it at around R[i,j] = {10 i = j, 0 else} and Q[1,1],Q[2,2] = .0001, 0 else (so I am treating the drift as having no noise). The Q matrix elements quoted correspond to the pitch and roll respectively.

When I pumped up the values in the covariance matrix I got behavior where the pitch and roll is way over-smoothed and the drift seems not to get registered. I get big spikes in pitch and roll which then slowly decay off. I will attach graphs of both behaviors.

I played with other values for a while but I either got one of the two behaviors described above, or really noise data that is obviously not filtered effectively.

If someone could help me identify the problem, or maybe just give me a better understanding of how to identify and understand the various measures of system noise, that would be extremely helpful, thanks!

File size:
18.3 KB
Views:
175
File size:
17.8 KB
Views:
202