# what kind of processing is required on raw IMU data before it is fed into a filter?

Im working on quadcopter. At this stage im coding a reference system for quadcopter using 10DOF board.At this stage im at the point of only getting raw data values from accelerometer, gyroscope, & magnetometer.

After searching around on web, I have rought idea of what I need to do, I need to implement a filter system that can help me determine accurate and stable position estimates from sensor data. Im planning on implementing kalman or Magwick based filter.

My Question:

1) Before I go into filter design itself, I want to know do I just use the raw data from sensor ' as it is ' and feed it into filter system ? Or Do i need to some sort of preprocessing on data for filter to use ?

2) My second question is, after just glancing over some code on web, I saw alot of people adding some constants to their raw sensor data (i.e offsets? ) to smooth or correct raw sensor data. What kind of smoothing/correcting do i need to account for ? How does it relate to imu sensors ?

1) Before I go into filter design itself, I want to know do I just use the raw data from sensor ' as it is ' and feed it into filter system ? Or Do i need to some sort of preprocessing on data for filter to use ?

Both happens. In my applications(Visual-Inertial SLAM) we tend to just use the raw measurements. Note that the fusion algorithm(Kalman filters or Complementary filters) essentialy work as some sort of preprocessing step.

2) My second question is, after just glancing over some code on web, I saw alot of people adding some constants to their raw sensor data (i.e offsets? ) to smooth or correct raw sensor data. What kind of smoothing/correcting do i need to account for ? How does it relate to imu sensors ?

The offset you are seeing is called the bias. This is required for good state estimation. Essentially it contains all the extra parameters that effect your readings, but that you are too lazy to model. You estimate these along with the rest of your states.

Therefore your state vector would typically be something like:

$$[p,v,q,a_b,g_b,m_b]$$

• $$p$$ position
• $$v$$ velocity
• $$q$$ quaternion/attitude
• $$a_b$$ accelerometer bias
• $$g_b$$ gyro bias
• $$m_b$$ magnetometer bias

To then get your actual measurement you subtract the bias.

So

$$a_{real}=a_{raw}-a_{bias}$$

• Does raw numerical values from imu sensors, need to be converted to angles,rate of change of angles, magnetic or true north (e.t.c) from sensors before it is fed into mathematical filter system? Or filtering takes place before this step ? Also How do I determine accelerometer, gyro, magnetometer biases? – calculusnoob Mar 17 at 2:31
• No. IMU outputs $m/s^2$ and $rad/s$. Those are the values your filter accepts. Not too sure about magnetometer as I never use one. For cheap IMUs(<\$2000) they need to be estimated online. Generally you need some sort of additional sensor like GPS,VO. The biases are then just updated along with the rest of the states in the EKF update. – edwinem Mar 17 at 16:12