Forum: General Topics

Forums / General Topics / A bug(?) and a question...

 

Subject:A bug(?) and a question... 

ChrisM

13:10
Wednesday
28-May-2008

Location:
Bedfordshire, UK

Phone Model:
Sony Ericsson W770i, Blackberry Playbook(?)

Ok, first the bug (if you can call it that...)
On the route screen, there is the list of routepoints down the LHS. I'm guessing that the 2 distances in each one are the distance from the start of the route, and the distance from the current position(??)
Even though I've selected imperial as my measurment preference, and although nearly everything correctly shows in miles or feet, the FIRST route point has 0m rather than 0ft (It really doesn't bother me, but if you are a perfectionist, you might want to fix it) :-) Or am I missing something?

The question relates to the other figure with each routepoint (the one I assume to be distance from the current position) This never seems to fall much below 400ft even when I apparently reach the routepoint. Am I doing something wrong?


Chris.
 

Stephen

14:07
Wednesday
28-May-2008

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

Hi Chris,

Well spotted, in both cases! The units display bug was easily fixed, I have my phone set to Metric so hadn't noticed this before.

I can't believe I hadn't spotted the second bug though as it is a real glaring error! Looks to be a rounding error in the distance calculation code, so it will affect all distance readouts, including waypoints and track lengths (though only where the distances are small - the error becomes negligible as the distance increases).

I'll have to look into this in more detail but will have it fixed for the next version...

Cheers!
Stephen
 

ChrisM

16:27
Wednesday
28-May-2008

Location:
Bedfordshire, UK

Phone Model:
Sony Ericsson W770i, Blackberry Playbook(?)

No worries, I'll keep looking and see what else I can find... ;-)

Something else that crossed my mind the other day (just tell me and I'll go away!). Would it be possible to put a kind of 'pause' option on the track recording? Sometimes, if I go indoors or something, my GPS device can go a bit loopy with indirect/bounced/reflected signals, and I sometimes finish up with a messy 'scribble' in the middle of my track.
I suppose the other way of dealing with this is to up the minimum distance between recording points so that it generally doesn't record while this is happening, but in some places (especially my wife's nan's flat for some reason) I can sometimes apparently be moving several hundred feet at 10-15 miles/hour whilest sitting on the sofa!!!
I don't know how difficult it would be technically, but an option in the appropriate screens to 'Pause/Resume Track' would work for me :-)

PS. Do you let people have the source to TMJ? I'm not a Java programmer, but I know my way round a bit of C# code which I believe to be similar, and it'd be quite interesting to see how some of this works!
 

Stephen

16:42
Thursday
29-May-2008

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

Hi Chris,

" I'll keep looking and see what else I can find... ;-) ... Something else that crossed my mind the other day (just tell me and I'll go away!). "

No, thats absolutely fine, any positive feedback is always welcome!

The 'Pause recording' idea might indeed have some use - I also find it a bit annoying myself when the track starts jumping around due to a weak GPS signal. In a way this should really be dealt with by the track 'smoothing' code, which tries to eliminate GPS data that seems inaccurate, for example by ignoring data from the GPS when it reports its accuracy to be below a certain threshold. However, its difficult to reach a happy medium in smoothing out 'spikes' whilst not losing any useful information, so the ability to pause the track could be quite useful.

Regarding the source code, I'm sure you'll understand that I'd rather not release this - although TMJ is free at the moment I need to leave my options open for the future! Having said that, I'm happy to show you a snippet, for example this is the routing code that tests whether the active routepoint has been reached:

if (GPSData.selectedRoutepoint!=null) {
 calcRoutepointLocation();

 if (GPSData.sDISTANCETORTE<GPSData.selectedRoutepoint.minDistance)
  GPSData.selectedRoutepoint.minDistance=GPSData.sDISTANCETORTE;

 if (GPSData.sDISTANCETORTE<5
  || (GPSData.sDISTANCETORTE<250 && GPSData.sDISTANCETORTE>
  (GPSData.selectedRoutepoint.minDistance*1.05))
  || (GPSData.sDISTANCETORTE>250 && GPSData.sDISTANCETORTE>
  (50+GPSData.selectedRoutepoint.minDistance*1.25))) {
        
  if (GPSData.selectedRoutepoint.startNewSection) {
   forceNewPoint=true;
   forceNewSection=true;
   LLA newpoint=filteredLoc.clone();
   newpoint.time-=100;
   GPSData.addTrackPoint(newpoint,true,true);
  }
        
  GPSData.selectedRoutepointIndex=
   GPSData.route.indexOf(GPSData.selectedRoutepoint);

  GPSData.routepointMovedFrom=
   GPSData.selectedRoutepointIndex;

  GPSData.selectedRoutepointIndex++;

  if (TMJOptions.optCircularRoute)
  GPSData.selectedRoutepointIndex=
   GPSData.selectedRoutepointIndex % GPSData.route.size();
        
  if (GPSData.selectedRoutepointIndex<GPSData.route.size()) {

   GPSData.selectedRoutepoint=(TMJRoutepoint)GPSData.route.
    elementAt(GPSData.selectedRoutepointIndex);
   GPSData.selectedRoutepoint.minDistance=999999999;
   calcRoutepointLocation();

  } else {

   GPSData.selectedRoutepoint=null;
   GPSData.selectedRoutepointIndex=-1;
   GPSData.sDISTANCETORTE=0;
   GPSData.sBEARINGTORTE=0;

  }

  GPSData.calcRouteStats();
        
  if (TMJOptions.optRoutepointAlerts) {

   if (GPSData.selectedRoutepoint==null)
    TMJCanvas.setInfoMessage("Routepoint Reached","Route complete!",3000);
   else {
    TMJCanvas.setInfoMessage("Routepoint Reached",
     "Next routepoint: " +FnFormatting.formatItem(TMJOptions.uDISTANCETORTE)
     +"\n Route remaining: " +FnFormatting.formatItem(TMJOptions.uROUTEREMAINING),3000);
   }

  }
 }
}

Easy, huh!

Cheers,
Stephen
 

Stephen

20:28
Thursday
29-May-2008

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

I've just been looking into the rounding error in the Routepoint distance readout. Turns out it wasn't a maths error after all!

Its due to the distances displayed on the Route and Waypoints page being calculated taking your current altitude into account. The 'altitude' for waypoints and routepoints is fixed at zero, so even though your latitude/longitude was very close to that of the waypoint, the readout was showing you 400ft above it! I've changed this for the next version...

Note that this only affects the Route and Waypoints pages - the figures displayed on the Plan/Nav/Map/Text pages are correctly calculated without the altitude being taken into account.

Cheers,
Stephen
 

ChrisM

8:45
Friday
30-May-2008

Location:
Bedfordshire, UK

Phone Model:
Sony Ericsson W770i, Blackberry Playbook(?)

" so even though your latitude/longitude was very close to that of the waypoint, the readout was showing you 400ft above it "
Haha! Maybe you should change the directional arrow so that it can rotate in 3 dimensions?? If it had been pointing straight INTO the screen, I could have realised what was going on :-)
I suppose it's quite easy to only think in terms of Lat/Long, and to forget that your location is in 3D. Mind you, if you were in an aircraft...!

Thanks for the code snippet, was quite interesting. It does indeed look very much like C#. That section at least, seems fairly straight-forward, but of course it's generally easier to read it than write it, and a lot of the hard work is going on in objects and methods that are only referenced here, plus this is only a tiny part of the whole. I imagine there must be one heck of a lot of code in the whole project! It certainly must keep you busy. What is your day job? Or is this it...! :-)

Cheers,

Chris.
 

Stephen

10:04
Friday
30-May-2008

Location:
Surrey, UK

Phone Model:
BB 9800 Torch
BlackBerry 8900
SE W910i
Nokia 5800

" I imagine there must be one heck of a lot of code in the whole project! "

Its fairly big I guess, though all the source code is less than 1MB in size - somehow doesn't seem all that much for 18 months work!

" It certainly must keep you busy. What is your day job? Or is this it...! "

I wish! IT Manager by day, then come home and spend the evening staring at another computer screen. Bit crazy really!! ;-)
 
 

11:37
Friday
30-May-2008

" ...though all the source code is less than 1MB in size - somehow doesn't seem all that much for 18 months work! "

Oh, I dunno, you can get a LOT of text in 1Mb. Your achievement will look a lot greater if you consider how many lines of code, or work out how many thick a stack of paper it would make if you printed it all out, or if you just think about what a neat application it is!
(btw, I'm investigating the clock thing. I'll post a reply in that thread soon)

Chris.
 

(You must be logged in to post a reply to this thread)