My idea is simple, the implementation can be impossible, though!

I would like to improve the precision of my position data beyond the simplest averaging that I am doing right now. I understood, from some readings, the best way to do that is to use a second set of data - in my case I would get encoder measurements of the wheels positions - on top of the US time-of-flights. Then, some appropriate statistical methods should allow me to optimize the measurements. I first thought about Kalman filter, but then SLAM seemed more adapted. Technically it is in the end a manipulation of several matrices -positions, velocities, errors -.

My question to the Arduino/Processing's experts is:

how to translate these statistical treatments of data (Kalman and/or SLAM) in Processing language (I thought it was some kind of Java, that is the reason why a refer to it)?

Does anyone ever tried to have an efficient statistical treatment of data coming out of sensors and going to a computer through an Arduino board?

If yes, please let me knoow what it was.