[squeak-dev] MadgwickAHRS plugin and support code (was: Building a linux/Pi library to call via FFI)

Chris Cunnington brasspen at gmail.com
Sun Sep 13 03:18:16 UTC 2015


Cool. I'm going to try this out.

Chris
On Sep 12, 2015 7:47 PM, "David T. Lewis" <lewis at mail.msen.com> wrote:

> On Thu, Sep 10, 2015 at 10:29:24AM -0700, tim Rowledge wrote:
> >
> > On 09-09-2015, at 6:53 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> >
> > > On Wed, Sep 09, 2015 at 11:17:08AM -0700, tim Rowledge wrote:
> > >> I?m trying - and so far failing - to do what should surely be a very
> simple
> > >> thing. This isn?t a new situation?  especially on unix.
> > >>
> > >> I have a single C file with just two functions. I have a matching H
> file.
> > >> I want to make them into a dynamic library that I can call via FFI.
> This
> > >> really shouldn?t be rocket science stuff!
> > >
> > > <OT>
> > > I assume there is some good reason that you would not do an end run
> > > around all that rocket science and just write a plugin?
> >
> > Well I *did* originally point out that there was probably a really
> stupid mistake in my process and that is pretty much it. In my defence I
> was in the midst of FFI-ing to multiple external libraries for assorted Pi
> add-on doohickeys and getting somewhat inured to the idea.
> >
> > But I think I may re-do it as a plugin today, not least because it seems
> that the ARM ffi interface has a problem with returning floats; they come
> back as Character null. I may not be a great IEEE floating point standard
> expert but that doesn?t seem quite right.
> >
>
> 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.
>
> It works with 32/64 bit image and host, and the plugin builds without
> complaint
> (trunk with Ian's Cmake build) if you put the library source files
> MadgwickAHRS.c and MadgwickAHRS.h in platforms/Cross/plugins/MadgwickAHRS/
>
> The MadgwickAHRS library is licensed GPL, so it would be best to link
> the plugin dynamically to e.g. /usr/local/iib/libwmadgwickIMU.so.1
> rather than static link to the C code as I have done so far. If there
> is any interest in the plugin, I'll see if I can figure out the linker
> magic.
>
> See class MadgwickAHRSTest for examples.
>
> Repository is at http://www.squeaksource.com/MadgwickAHRS
>
> Tim, I added you as developer on the squeaksource.com repository in case
> you
> want to make use of this.
>
> Dave
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150912/87b05571/attachment.htm


More information about the Squeak-dev mailing list