Josh Leverette's blog

Josh Leverette's picture

Multivariate Kalman filters

I'm now investigating multivariate Kalman filters. I don't know if I'll be able to get it tuned correctly, but as I summarized in yesterday's blog post, I haven't been able to find a way to apply particle filters to my particular situation. I feel like Kalman filters are a much better fit for this project, even though they have their own problems.

Josh Leverette's picture

Particle filters.. or Kalman?

Josh Leverette's picture

Designing a filter

At this point, I believe that I'm just trying to figure out how to design one of these filters, practically. I've started looking around at tutorials on particle filter design to attempt to get a better grasp on that side of things. For the short amount of time that I've been studying them, I believe that I have a pretty decent grasp of the theory behind a particle filter. Bridging the gap to actually designing my own is an interesting challenge.

Josh Leverette's picture

Particle filter code

Tonight I started writing the basics of a particle filter into my code, which led me to cross-reference against the tutorials I had looked at, again, in order to figure things out. Trying to write the code was fun tonight, and I hope to be more successful tomorrow, but I did get the code started.

Josh Leverette's picture

More filters

This weekend I'm back home visiting my parents, but I did spend some time this evening continuing to research filters. Hopefully I can find some more time this weekend to work on it and get it all figured out. I'm planning to get back to writing code on Monday, if at all possible.

Josh Leverette's picture


I have spent quite a number of hours tonight reading a couple of different chapters from this book (source here), and it has turned out to be an excellent resource. I learn best through visualization; I reason better with an abstract concept after I've seen visualizations of it, whereas most teachers I've ever had prefer to start with the mathematical notation first, which is purely abstract. Thus, the discovery of this IPython / Jupyter book about filters is deeply intriguing to me. It combines the abstract with the visual, not to mention some demonstrative code, and I am therefore enjoying it quite a bit.

Particle filters are interesting. I'm starting to see why they would take less tuning than a traditional Kalman filter, but at the same time I can also see why they would be more computationally intensive. Some of the discussion in this book seems to touch on why a Kalman filter might not be the optimal choice for a dead reckoning system. I believe this book is a great resource for anyone who wants to learn more about these types of filters.

EDIT: and why does this Drupal page seem to grow in unreliability with each passing day? I'm on a full, desktop version of Chrome right now and the Preview / Save buttons are completely dropping my blog post. I will keep submitting it occasionally until the server decides to start cooperating. Maybe someone is doing maintenance on the server? No idea, but it's weird behavior. (At least 10 minutes of trying to submit now)

Josh Leverette's picture

Particle filters

I began looking at particle filters, and while I learned some interesting things about them, such as that they are more computationally intensive than Kalman filters, I admit that I didn't spend quite as much time on task today as I had planned.

Josh Leverette's picture

Continued Kalman exploration

I've found some excellent material discussing single variable Kalman filters, and I believe I have a decent grasp of the concepts. I need to find some simple examples of multivariable Kalman filters, and to start modeling my system, which seems to be notably more complex than the examples I've read.

Edit: as noted elsewhere, I'll probably be looking at Bayesian particle filters tomorrow and see how they compare in terms of complexity and effectiveness with Kalman filters. It sounds like determining the exact values for a Kalman filtering system could sink large amounts of time, potentially.

Josh Leverette's picture

Kalman Filters

This evening I started looking over Kalman filters and trying to figure out how to apply those to my system. Hopefully I'll be able to get something demonstrable up and running in the next couple of days.

Josh Leverette's picture

Initial offset data!

I have attached a chart created from real-time on-MCU analysis of the 9-axis data to calculate current positional offset. I was piping every 75th absolute offset value over the serial terminal so I could create this chart while trying to balance loss of data from piping data over serial versus resolution of the chart. The chart was created in Excel, of course. So, the position of the device was being sample every 47ms, give or take. Right now, the algorithm is still in desperate need of some fixes that will increase its accuracy, and I have some ideas about those fixes, but I believed showing this raw output would be pretty interesting, nonetheless. There is some crazy drift on the X-axis, and I'm not sure what that's all about. I moved the device laterally by about a meter and returned it to roughly its initial position while these samples were being taken. The Z-axis, oddly enough, actually seems to align with the motion I made pretty solidly, and the Y-axis kinda does. The X-axis seems to have no bearing on reality though in this data.

Still, very interesting! I feel like I've actually made a lot of progress now.

Offset vs Sample

Syndicate content