Tangible progress

Josh Leverette's picture

This evening, I fixed the magnetometer so it actually works for more than one sample. I found that I had done the math wrong when I calculated the ODR constant and I was thus writing an invalid data rate to the magnetometer.

I also re-organized demo code so it collects all of the data before printing, which should help keep data samples as time-aligned as possible, something that had previously concerned me, though I may not have noted it here. I also separated a few useful functions from the demo into a helper file, removed some commented out code that had been forgotten in the demo, and collected some new data.

In lifereckoner, I re-organized the code so that dead reckoning is now a task, in some form or another. I'm not using a proper RTOS, though I would like to be using FreeRTOS, but I've never used it so I haven't tried integrating that yet. Just having the code broken out into a task means that it is possible I could implement a rudimentary RTOS now, which might be helpful at some point. I also created some global state that will be shared in the RTOS, namely the LSM9DS0 driver and the Serial port connection. None of that is really thread safe at this point, but as I don't have threading, that isn't much of a concern. I also added a quaternion to keep track of current orientation, and I plan to begin implementing the code to calculate initial orientation as Keith Packard discussed in his blog post.

In short, I felt like I actually made some useful progress today.