[Vm-dev] MadgwickAHRS plugin and support code (was: Building a
linux/Pi library to call via FFI)
tim at rowledge.org
Sun Sep 13 03:49:50 UTC 2015
On 12-09-2015, at 6:47 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> I don't know what got into me, but I brewed up a nice pot of coffee this
> morning and ended up with http://squeaksource.com/MadgwickAHRS/
> This is a plugin, accessor class, and unit tests that claim to demonstrate
> that the plugin works.
> I used FloatArray for parameter passing, on the theory that users of the
> plugin may be doing float (not double) arithmetic, so it may be more
> efficient to pass values in that manner.
Cool! I did actually write one as well, but I used an array of BoxedFloat64 (or whatever it is) for input and create a 4 element array for the quaternion result. I considered a FloatArray as well but
a) I’ve never used one before, so I’m scared of them
b) Won’t they be arrays of 64bit float values on a 64-bit image?
c) I’m pretty sure I will have to create a bunch of floats when reading the IMU chip anyway, so since I have them, might at well stick’em in an array.
I did consider making the array 13 long so the result could be just appended. Might be worth trying?
The good news is that on a Pi 2 the call as-is costs ~8micro-sec, which considering it apparently uses ~50 +, 60 -, 150 *, 14 / and 5 sqrt floating point calls is quite impressive.
And yes, I suppose we’ll need to keep this as an external plugin to dodge the gnu-stasi. Sigh.
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Oxymorons: Same difference
More information about the Vm-dev