BUG Community

Welcome! Log In

Forums BUG SDK Requesting position before BUGlocate has a fix

Subscribe to Requesting position before BUGlocate has a fix  16 posts, 4 voices

Log in to reply to this topic
 
Apr 29, 2008 11:26pm
Medium Bug Labs team finsprings 268 posts

I've yet to get a fix from BUGlocate, but I'm inside so that's perhaps not too surprising. I noticed in /var/log/concierge.log on the bug the following error though:

GpsLogger service tracker: starting app now services are available
GpsLogger: app starting
[Wed Apr 30 02:56:59 GMT 2008] [ERROR] Bundle/Modlet error occurred: java.lang.NumberFormatException, For input string: ","
[Wed Apr 30 02:56:59 GMT 2008] [DEBUG] java.lang.NumberFormatException: For input string: ","
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at com.buglabs.bug.module.gps.GPSModlet.getLatitudeLongitude(Unknown Source)
at gpslogger.MyApplication.start(Unknown Source)
at gpslogger.MyServiceTracker.doStart(Unknown Source)
at com.buglabs.application.AbstractServiceTracker.addingService(Unknown Source)
at org.osgi.util.tracker.ServiceTracker$Tracked.track(Unknown Source)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.notifyServiceListeners(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$BundleContextImpl.registerService(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$BundleContextImpl.registerService(Unknown Source)
at com.buglabs.bug.module.lcd.pub.LCDModlet.start(Unknown Source)
at com.buglabs.bug.bmi.pub.Manager.processMessage(Unknown Source)
at com.buglabs.bug.bmi.Activator.coldPlug(Unknown Source)
at com.buglabs.bug.bmi.Activator.start(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleImpl.startBundle(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.setLevel(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.access$000(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.startup(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.main(Unknown Source)
at sun.misc.CVM.runMain(Unknown Source)


It looks like my first call to getLatitudeLongitude is failing internally, possibly because it's not getting valid data yet. I do have my own DecimalFormat("##0.00;-##0.00") but I don't think it has had time to call that when this error occurs.
May 2, 2008 10:03am
Medium Bug Labs team jconnolly 285 posts

finsprings
I've yet to get a fix from BUGlocate, but I'm inside so that's perhaps not too surprising. I noticed in /var/log/concierge.log on the bug the following error though:

GpsLogger service tracker: starting app now services are available
GpsLogger: app starting
[Wed Apr 30 02:56:59 GMT 2008] [ERROR] Bundle/Modlet error occurred: java.lang.NumberFormatException, For input string: ","
[Wed Apr 30 02:56:59 GMT 2008] [DEBUG] java.lang.NumberFormatException: For input string: ","
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at com.buglabs.bug.module.gps.GPSModlet.getLatitudeLongitude(Unknown Source)
at gpslogger.MyApplication.start(Unknown Source)
at gpslogger.MyServiceTracker.doStart(Unknown Source)
at com.buglabs.application.AbstractServiceTracker.addingService(Unknown Source)
at org.osgi.util.tracker.ServiceTracker$Tracked.track(Unknown Source)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.notifyServiceListeners(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$BundleContextImpl.registerService(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$BundleContextImpl.registerService(Unknown Source)
at com.buglabs.bug.module.lcd.pub.LCDModlet.start(Unknown Source)
at com.buglabs.bug.bmi.pub.Manager.processMessage(Unknown Source)
at com.buglabs.bug.bmi.Activator.coldPlug(Unknown Source)
at com.buglabs.bug.bmi.Activator.start(Unknown Source)
at ch.ethz.iks.concierge.framework.BundleImpl.startBundle(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.setLevel(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework$SystemBundle.access$000(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.startup(Unknown Source)
at ch.ethz.iks.concierge.framework.Framework.main(Unknown Source)
at sun.misc.CVM.runMain(Unknown Source)


It looks like my first call to getLatitudeLongitude is failing internally, possibly because it's not getting valid data yet. I do have my own DecimalFormat("##0.00;-##0.00") but I don't think it has had time to call that when this error occurs.


Dave,

You're right, it looks like calling IPositionProvider's getLatitudeLongitude() class calls GPSModlet's getLatitudeLongitude method, which I think fails in toDecimalDegrees when parsing the raw GPS sentences. It's trying to parse a non-numerical string. I'll have Development take a look.

The offending code looks something like this:

pProvider = (IPositionProvider) getService(IPositionProvider.class.getName());
System.out.println("Latitude: "+pProvider.getLatitudeLongitude().latitude);
System.out.println("Longitude: "+pProvider.getLatitudeLongitude().longitude


As a workaround, you can determine whether the RawFeed is null, and when it's not (i.e. when you get a fix), get the position. Something like this:

InputStream is;
INMEARawFeed rawfeed = (INMEARawFeed) serviceProv.getService(INMEARawFeed.class)
IPositionProvider pProvider = (IPositionProvider) serviceProv.getService(IPositionProvider.class);
InputStream is;
int read = 0;;
if (is == null) {
is = rawfeed.getInputStream();
}
try {
if ((read = is.read()) > 0) {
//you can do something with the buffer or just dispose it
double latitude = pProvider.getLatitudeLongitude().latitude;
double longitude = pProvider.getLatitudeLongitude().longitude;
}
} catch (IOException e) {
is = null;
fos.close();
}
May 2, 2008 10:41am
Medium Bug Labs team finsprings 268 posts

Thanks John. I’ll try and take the bug outside over the weekend – I’ve not gotten any fixes yet, but I’ve only had it indoors.

May 2, 2008 3:45pm
Medium Bug Labs team jconnolly 285 posts

finsprings
Thanks John. I'll try and take the bug outside over the weekend - I've not gotten any fixes yet, but I've only had it indoors.


Dave,

I think you'll have better luck outdoors. For me, I've got an external antenna that I use and it really reduces the amount of time required to get a location fix, even in NY where seeing the sun up through the buildings can be difficult :wink: :wink:. The BUGlocate module's antenna receptacle is MMCX, a tiny form of coax. GPSLoggerSimpleGUI toggles between external and onboard antennas with the push of a button, if you wanted to try it out.

http://tinyurl.com/6or2vm For a list of antenna's. They're pretty cheap.
May 7, 2008 10:27pm
Medium Bug Labs team finsprings 268 posts

John,

I haven’t stuck that app on it yet, but I tried the following:

I had the bug setup, with no apps and only the GPS module attached. I powered it on and took it outside and left it with a good view of most of the sky for about 15 minutes. Modules/GPS/GPS_Fix still showed "false" after this time.

If it had gotten a fix, would you expect that to return "true"?
Also, what does IOX=0×43 mean?

Cheers,
Dave

May 7, 2008 10:42pm
Medium Bug Labs team finsprings 268 posts

John,

I installed GPSLoggerSimpleGUI but it only shows a blank window – no text labels or data. Does it only show that once it gets a fix? Or it is perhaps hitting the same getLat/Lon issue I saw in my app?

I’m going to go order an antenna now, but I would expect the internal one to have worked outside.

Cheers,
Dave

May 7, 2008 10:58pm
Medium Bug Labs team finsprings 268 posts

John, sorry for all the posts, but I powered the device on for a third time and it properly displays the antenna status and GPS Log (with no fixes) – previously it was just a blank window with no titles and no text.

Does Antenna On true/false refer to the internal or external antenna?

Also, in case its related, the bug’s sys.log and kernel.log show quite a few entries like this:

May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 1
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:27 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:27 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 1
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0

and the concierge.log shows:

Buttonevent: 1
Key: 1
Buttonevent: 0
Key: 1
Trying
Equality? false
ContositionProvrol Status:111110000011
11101000011
Equality? true
ContositionProvrol Status:11101000011
Buttonevent: 1
Key: 1
Buttonevent: 0
Key: 1
Trying
Equality? true
ContositionProvrol Status:111101000011
111110000011
Equality? false
ContositionProvrol Status:111110000011

May 8, 2008 9:17am
Medium Bug Labs team jconnolly 285 posts

finsprings
John, sorry for all the posts, but I powered the device on for a third time and it properly displays the antenna status and GPS Log (with no fixes) - previously it was just a blank window with no titles and no text.

Does Antenna On true/false refer to the internal or external antenna?

Also, in case its related, the bug's sys.log and kernel.log show quite a few entries like this:

May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 1
May 8 02:53:26 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:27 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:27 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 1
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 1, Code: 258, Value: 0
May 8 02:53:30 localhost kernel: evbug.c: Event. Dev: bugnav, Type: 0, Code: 0, Value: 0

and the concierge.log shows:

Buttonevent: 1
Key: 1
Buttonevent: 0
Key: 1
Trying
Equality? false
ContositionProvrol Status:111110000011
11101000011
Equality? true
ContositionProvrol Status:11101000011
Buttonevent: 1
Key: 1
Buttonevent: 0
Key: 1
Trying
Equality? true
ContositionProvrol Status:111101000011
111110000011
Equality? false
ContositionProvrol Status:111110000011


Dave,

It's great that you're getting down to the bare metal with the GPS functionality.

It's true that the onboard antenna can take quite some time getting a location fix. At times, I've had to wait upwards of twenty minutes before getting a signal. This is very unfortunate, and I'm hoping that there is a fix for it soon, if there is a software remedy.

With regard to the kernel.log output, those events you're seeing correspond to button events generated from the joystick. You may also see output from touch events on the LCD screen, and others. I'll get the specifics of the output messages together and tailor a more informative post perhaps on the BUGmodules section of this forum.

The concierge.log output is from some System.out statements I had for debugging purposes when writing the app. I'll take a look at the source again, but this should either be thrown into the LogProvider.log mechanism, or at the very least only if a static final variable DEBUG is set to true. I just wanted to verify that the external antenna control is enabled/disabled at the hardware level, which involves bitmasking and the like, hence the output.
May 8, 2008 9:21am
Medium Bug Labs team finsprings 268 posts

Ah, I thought "bugnav" was referring to GPS, but it’s menu nav :-)
Makes sense now.

May 10, 2008 10:36pm
Medium Bug Labs team finsprings 268 posts

jconnolly
It's true that the onboard antenna can take quite some time getting a location fix. At times, I've had to wait upwards of twenty minutes before getting a signal. This is very unfortunate, and I'm hoping that there is a fix for it soon, if there is a software remedy.

FWIW, my Magellan 2200 GPS also has a SirfStar III in it, and without any external antenna it picks up 8-10 satellites in my house pretty quickly. Of course it's a little bigger, and single purpose, but it would be interesting to know what sort of internal antenna it has.
May 11, 2008 4:55pm
Medium Bug Labs team kschultz 107 posts

There is something funky about the way devices go about acquiring GPS signals. I have a Garmin unit and some days it takes 30 seconds and some days it takes 20 minutes to acquire. I do not understand the intricacy of the connection but it is frustrating when it takes a while to ascertain where you are.

May 12, 2008 9:51pm
Medium Bug Labs team finsprings 268 posts

John, my external antenna arrived today. I see the LCD gps_fix field for the GPS module say ‘true’ now and the BUGlocate module’s LED is blinking green instead of red.

I still rarely see your GPSLoggerSimpleGUI come up properly: usually it just shows a blank screen. I think this is because of the same problem I was seeing, as I ran it once with a serial connection doing a ‘tail -f /var/log/concierge.log’ and saw it report:

java.lang.NumberFormatException: For input string: "4043.8629,N" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.FloatingDecimal.readJavaFormatString(Unknown Source) at java.lang.Double.parseDouble(Unknown Source) at com.buglabs.bug.module.gps.GPSModlet.getLatitudeLongitude(Unknown Source) at gpslogger.GPSLoggerApplication.run(Unknown Source) at java.lang.Thread.startup(Unknown Source)

That at least looks like a sort of valid value doesn’t it? Or is that only a lat without a lon perhaps?

May 12, 2008 10:53pm
Medium Bug Labs team finsprings 268 posts

So, the empty frame doesn't appear to be related to getting a fix at all. Your run method was throwing an error on the getLatLon but it was only dumping that to stdout anyway, so I commented those lines out. I also added a little more debug so the frame would say that it was waiting for a fix, and so on. And when it comes up properly, I can see raw NMEA data on the screen. But still, about half the time I get a blank frame.

FWIW, this is how I have the main loop in you run() method at the moment:

while (!tearDownRequested) {
taLog = GregorianCalendar.getInstance().getTime() + " ";

// Main application loop the run method will commence
// once all service dependencies are satisfied.
if ((control.getStatus() & 0x01) == 0) {
// we have a fix
if (is == null) {
is = rawfeed.getInputStream();
}

if (is == null) {
taLog += "got a fix, but still waiting for an input stream";
}
else {
try {
if ((read = is.read(buff)) > 0) {
fos.write(buff, 0, read);
//System.out.println("Latitude: "+pProvider.getLatitudeLongitude().latitude);
//System.out.println("Longitude: "+pProvider.getLatitudeLongitude().longitude);
taLog += new String(buff);
}
} catch (IOException e) {
is = null;
fos.close();
}
}
} else {
// no fix yet
taLog = "still waiting for a fix";

if (is != null) {
is.close();
is = null;
}
}
taLog += "\n";
frameLog.setText(taLog);
frame.repaint();
sleep(1000);
}
May 13, 2008 7:13am
Medium Bug Labs team jconnolly 285 posts

finsprings
So, the empty frame doesn't appear to be related to getting a fix at all. Your run method was throwing an error on the getLatLon but it was only dumping that to stdout anyway, so I commented those lines out. I also added a little more debug so the frame would say that it was waiting for a fix, and so on. And when it comes up properly, I can see raw NMEA data on the screen. But still, about half the time I get a blank frame.

FWIW, this is how I have the main loop in you run() method at the moment:

while (!tearDownRequested) {
taLog = GregorianCalendar.getInstance().getTime() + " ";

// Main application loop the run method will commence
// once all service dependencies are satisfied.
if ((control.getStatus() & 0x01) == 0) {
// we have a fix
if (is == null) {
is = rawfeed.getInputStream();
}

if (is == null) {
taLog += "got a fix, but still waiting for an input stream";
}
else {
try {
if ((read = is.read(buff)) > 0) {
fos.write(buff, 0, read);
//System.out.println("Latitude: "+pProvider.getLatitudeLongitude().latitude);
//System.out.println("Longitude: "+pProvider.getLatitudeLongitude().longitude);
taLog += new String(buff);
}
} catch (IOException e) {
is = null;
fos.close();
}
}
} else {
// no fix yet
taLog = "still waiting for a fix";

if (is != null) {
is.close();
is = null;
}
}
taLog += "\n";
frameLog.setText(taLog);
frame.repaint();
sleep(1000);
}


Dave,

I've seen the blank Frame problem with this app too. I'm not 100% sure why it won't complete initializing, and others it will. I'm thinking an exception is getting squelched somewhere and no informative output is displayed to the screen, something like a blank catch() block. I'll have to spend some time debugging it.

I don't know if you've tried it already, but in addition to the /var/log/concierge.log, to access the Concierge console from the host system, you may

telnet 10.10.10.10 8090

And use it just the way you would in the Eclipse console in Dragonfly mode. Using the Concierge OSGi printlog command may be informative as to what is happening with the application. I'll check this out soon.
Oct 24, 2012 1:46am
User_img_not_found_01_med qazqazqaz 469 posts