[racket] moby/phonegap/android: use acceleration or geolocation to derive velocity?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed Nov 3 11:48:05 EDT 2010

> At the moment, the successCallback in the adapted phonegap.js receives the latitude and longitude only, whereas in the original (current) phonegap.js the complete Position object is returned. Is this intentional - I mean, does moby diverge from phonegap on purpose here (like experience showed the other fields are not reliable anyway, or not too much requested by users, or ...)? Or was this a modification to keep it simple at first, to be possibly extended later?

The modifications were done just to make the types match up for the
the world callbacks, which expected single values rather than compound
ones.  I think it should also work to pass in the original object,
though we need to fix the ffi bindings on the Racket end to match.

We do have a fork of Phonegap in the repository.  I do remember that
we had to make a few changes to Phonegap to make shutdown and pausing
work more reliably.  Eventually, we'll come back to mainline Phonegap,
as I don't think we should be doing anything too customized, though
our FFI needs to be further developed before we take this step.

> would you make world-updater a variable arity function, or use case-lambda or keyword arguments to obtain the desired flexibility, or rather create and pass a 'position' object analogous to the javascript-side Position object?

I've been opting toward providing the values as additional arguments
to world updaters because it allows for world programming without
needing to know about structures.  If the events are richer, then it
makes more sense to present the structured event.

> BTW I noticed that in phonegap's (current) phonegap.js, there are no observers for orientation and shake... I'm just curious, was this functionality added during moby implementation (i.e., it never existed in phonegap's own phonegap.js), or it was removed in a newer phonegap release?

At the time that we started working with Phonegap, some of the
handlers were broken, and so we did some work to enable them.  It's
probable that the Phonegap developers just removed that code instead.
I know we (more specifically, Ethan) added shake as a convenience for
users.  The azimuth, pitch, roll values for orientation did exist in
Phonegap, but I do remember we had to fiddle with the source to make
it work.

Posted on the users mailing list.