To combine the accelerator and the gyroscope sensor output data often a complimentary filter (also called balance filter) is used:
This can be implemented as such:
source: Shane Colton <email@example.com>
This filter can be very easily implemented in any embedded application. I was pretty happy with the performance of this filter. I did like the ability to tune the filter performance to the system needs.
At the moment I do use the sensor fusion of Sebastian Madgwick since it offers a 9 DOF fusion method that allows for adding to the accelerator and the gyro data the magnetometer data of the MPU9250 as well.
The Madgwick filter is used to filter and fuse raw data from IMU devices. It fuses angular velocities, accelerations, and (optionally) magnetic readings from a generic IMU device into an orientation quaternion.