The Bug Labs asynchronous GPS API that we can't get working (mentioned in the previous blog post) with Simon's identicon program is: IPositionSubscriber
I'll report this in the Bug Labs forums and then update this post.
Back in August using Bug Labs Release 1.4.1, Simon Lewis and I got his Bug Labs bug identicon app that generates identicons based on GPS coordinates to work. Unfortunately that used the Bug Labs synchronous API i.e. polling which runs down the battery. The working version is 1.0.3 and you can see the output of 1.0.3 in the video above.
It's still broken in Bug Labs Release 1.4.2 Full yak shaving details after the jump!
So the next step was to try the asychronous API. It didn't work. The Concierge component framework would crash:
root@bug:~# tail -f /var/log/concierge.log
[Thu Jan 01 00:01:39 GMT 1970] [INFO] CoolApp 1.1.1: code != lastCode
[Thu Jan 01 00:01:39 GMT 1970] [INFO] IdenticonComponent: Initialized image and got sun.awt.qt.QtImage@86b11f3a
[Thu Jan 01 00:01:39 GMT 1970] [INFO] IdenticonComponent: image == sun.awt.qt.QtImage@86b11f3a
[Thu Jan 01 00:01:39 GMT 1970] [INFO] CoolApp 1.1.1: CoolApp.newIdenticon(...)
[Thu Jan 01 00:01:39 GMT 1970] [INFO] CoolApp 1.1.1: CoolApp.newIdenticon(...): Writing /usr/share/java/./storage/default/39/data/identicons/4915.17N_1234.19W.png
[Thu Jan 01 00:01:40 GMT 1970] [INFO] CoolApp 1.1.1: Got position update
[Thu Jan 01 00:01:40 GMT 1970] [INFO] CoolApp 1.1.1: Latitude[0.8596597123194212 rad] Longitude[-2.1480144386300855 rad]
[Thu Jan 01 00:01:40 GMT 1970] [INFO] CoolApp 1.1.1: Computing digest
[Thu Jan 01 00:01:40 GMT 1970] [INFO] CoolApp 1.1.1: Got digest
[Thu Jan 01 00:01:40 GMT 1970] [INFO] CoolApp 1.1.1: code == lastCode
II) every other time it didn't appear to run, it just hangs after it starts
ar]:
java.lang.LinkageError: trying to redefine class com.buglabs.bug.jni.common.CharDevice (bad class loader?)
at java.lang.Class.addToLoaderCache(Native Method)
at java.lang.Class.loadSuperClasses(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findOwnClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findDelegatedClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Compiled Method)(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.loadSuperClasses(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findOwnClass(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Compiled Method)(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.buglabs.bug.input.pub.InputEventProvider.run(Unknown Source)
at java.lang.Thread.startup(Unknown Source)
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registering info service.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /support
STARTING file:./com.buglabs.bug.service.jar
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /service
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet at /service.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered resources /
STARTING file:./com.buglabs.bug.program.jar
[Thu Aug 06 21:46:14 UTC 2009] [INFO] UserAppManager init: false
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /program
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /configuration
STARTING file:./com.buglabs.bug.module.jar
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /module
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet at /module.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet /package
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Registered servlet at /package.
STARTING file:./com.buglabs.bug.bmi.jar
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.gps (0001) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.camera (0005) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.lcd (0003) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.motion (0002) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.vonhippel (0007) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.audio (000A) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.wifi (0008) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Added modlet factory com.buglabs.bug.module.bugbee (0009) to map.
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Creating pipe /tmp/eventpipe
[Thu Aug 06 21:46:14 UTC 2009] [INFO] Execution Completed. Response:
[Thu Aug 06 21:46:15 UTC 2009] [INFO] Initializing existing modules
[Thu Aug 06 21:46:15 UTC 2009] [INFO] Registering existing module with message: 0003 0 0 ADD
[Thu Aug 06 21:46:15 UTC 2009] [INFO] Started modlet from factory com.buglabs.bug.module.lcd...
[Thu Aug 06 21:46:15 UTC 2009] [INFO] Registering existing module with message: 0001 0 1 ADD
[Thu Aug 06 21:46:15 UTC 2009] [INFO] GPSModlet setting active (external) antenna
CoolAppServiceTracker: start
[Thu Aug 06 21:46:16 UTC 2009] [INFO] CoolApp 1.1.1: CoolApp.start()
[Thu Aug 06 21:46:16 UTC 2009] [INFO] Started modlet from factory com.buglabs.bug.module.gps...
[Thu Aug 06 21:46:16 UTC 2009] [INFO] Listening to event pipe. /tmp/eventpipe
STARTING file:./com.buglabs.bug.event.jar
[Thu Aug 06 21:46:16 UTC 2009] [INFO] Registered servlet /event
[Thu Aug 06 21:46:16 UTC 2009] [INFO] Registered servlet at /event.
STARTING file:./com.buglabs.bug.slp.jar
---------------------------------------------------------
Framework restarted in 7.075 seconds.
---------------------------------------------------------
So I had high hopes for the recently introduced Bug Labs Release 1.4.2. I hoped that the asynchronous API would be fixed. Based on the 1.4.2 release notes, I didn't think it was fixed and today I am blogging this to confirm it's still broken in 1.4.2 Instead of a crash with a nice traceback, I now just get signal 11 with no traceback:
Poky Linux 3.1 on BUG
root@bug:~# tail -f /var/log/concierge.log
RESTORED BUNDLE file:./com.buglabs.bug.program.jar
RESTORED BUNDLE file:./com.buglabs.bug.module.jar
RESTORED BUNDLE file:./com.buglabs.bug.bmi.jar
RESTORED BUNDLE file:./com.buglabs.bug.event.jar
RESTORED BUNDLE file:./com.buglabs.bug.slp.jar
RESTORED BUNDLE file:/usr/share/java/apps/CoolApp.jar
STARTING file:./service-tracker.jar
STARTING file:./com.buglabs.osgi.shell.jar
Process #3983 received signal 11
Process #3983 being suspended
I finally upgraded my Bug Labs Bug kernal and root file system to 1.4.1 (instructions on my Bug Adventures wiki under July 26, 2009) and my GPS now works! yes! Now to write some fun software!
(Part 2 of my Bug Adventures series, for more real time wiki action check out my Bug Adventures wiki where I flesh out my thoughts before posting them here!)
Why doesn't my GPS aka BUGgps seem to work?
By "not working", I mean it doesn't get a GPS satellite lock which
results in a Java exception for those using the high level API and void
values e.g. "$GPGLL,,,,,022837.595,V*1D "for apps reading the RAW GPS
sentences. My guess is it's a low level software bug that will be
fixed in the "real soon now" R1.4 software release. Note that I have
attached the external antenna and put it on the window sill where my
other GPSes (Nokia LD-4W, Nokia E71) have no problems obtaining a GPS
lock!
"navigate the front-panel menu to the GPS module
and you will be able to see fix: True/False and IOX, which is the value
of the IOX register:"
(front panel led sequence is: modules->GPS->IOX) I get 0x63 which means
bit 0: 1 == no GPS fix, since fix is active low
bit 1: 1 = no overcurrent condition
bit 2: 0 = no wakeup from sleep
bit 3: 0 = don't know what this is, guess is 0 means don't download firmware
bit 4,5 unused
bit 7,6 0,1 == external antenna
Other people's code I have tried
GPSRawFeedExample always outputs "V*blah" which I think means void!
e.g. $GPGLL,,,,,051302.397,V*10
GPSLoggerSimpleGUI - the GUI doesn't work but at least the program doesn't crash :-)
GPSLogger2 creates a zero length file in /tmp but does nothing else e.g. /tmp/GPSSun Jan 04 20:25:49 UTC 2009.log
GpsLogger_1.1 java.lang.NullPointerException
at com.buglabs.bug.module.gps.GPSModlet.getLatitudeLongitude(Unknown Source)
My friend Simon's app has the same bug as GPS Logger 1.1 i.e. java.lang.NullPointerException
at com.buglabs.bug.module.gps.GPSModlet.getLatitudeLongitude(Unknown Source)
Simon's guess: the NMEA sentence they are getting from the underlying
hardware isn't quite in the format they expect, so they end up trying
to get a double out of the string ","
Evidence that this is a Bug that's being worked on:
this fix went into svn trunk (svn://svn.buglabs.net/bug/trunk ) on December 14, 2008, http://svn.buglabs.net/svn/!revision/7632
// default to passive (external) antenna, until
// such time as we have confidence in the internal
// antenna's ability to obtain a fix
log.log(LogService.LOG_DEBUG, "GPSModlet defaulting to passive (external) antenna");
setPassiveAntenna();