I'm working on a project to combine a linear acceleration reading from an accelerometer and gyroscope, adjusted for gravity, into displacement/position on an x-y plane, specifically for turning the motion of the sensor into mouse motion. I have a basic implementation working, but the movement feels very noisy and unnatural.
Essentially I'm following the "double integration" method. I've done some research and am familiar with some of the limits to overall accuracy of this approach, but its been my impression that people are talking about this in the context of dead-reckoning for navigation, so I was hoping we could get a "good enough" solution for mouse movement feels relatively natural. Especially since at some level if its being used to register mouse movement there'll be a feedback loop from the user controlling the mouse.
One of the biggest problems is that I haven't found a satisfactory way to remove noise that doesn't degrade the overall feel of the motion too much. I've tried Kalman filters, but have only gotten it working via external libraries such as Kalman.js given the complexity of the math behind it. So it could've partly been down to not having the right parameters for the filter. However I've also read that a Kalman filter may be a bad choice for smoothing mouse movements since its hard to model the underlying system of a person moving a mouse around to interact with a computer.
Is there a different filtering technique we could apply to smooth the movement readings out? Or is producing a reasonable short lived estimate of displacement, even for this application of producing mouse movements, ultimately too difficult with just an inexpensive accelerometer/gyro?