#187960 - 03/11/2003 17:07
Is this a bug in GPSapp or the python script?
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
I've got a route that tells me to turn right when it's clearly a left.
In the past, this was caused by there being two data points very close together, right at the intersection in question, and the actual turn seeming to GPSapp (on a very small scale) to be going the other way. This I can understand.
But in this case, we're talking about two data point that are exactly the same:
2774 -1955
2812 -1963
2812 -1963 HWY 49 NORTH
2821 -1927
2828 -1900
I'm told to turn right there, but it's a left. Is there any way to get GPSapp to ignore one of the two data points that are the same like that?
I know that either deleting the extra data point, or moving the turn instruction up to the first of the two data points, would correct the problem. But what about situations where I don't know that MapsOnUs has fed me this kind of data and it's in the player and it's now too late?
|
Top
|
|
|
|
#187961 - 03/11/2003 21:40
Re: Is this a bug in GPSapp or the python script?
[Re: tfabris]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
Well, I'm not sure what the "correct" answer is. However, in route.c:
if (turn < 0.0) {
heading = "LEFT";
turn = -turn;
} else
heading = "RIGHT";
But that doesn't explain why you get a turn instruction at all, since if "turn" is <= 5, you should get "continue onto" mumble. Which means the heading isn't being computed right, and the "RIGHT" is because of the above. Probably a duplicate point should be stripped, and probably it should be done in the python script.
|
Top
|
|
|
|
#187962 - 03/11/2003 21:43
Re: Is this a bug in GPSapp or the python script?
[Re: tfabris]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
Actually, hmmm. In the parse script:
# create a route as a combination of 'shape' and 'turn' information
# make sure we discard duplicate records.
waypoints = []
for i in range(-1, len(coords)):
if route.has_key(i):
if len(waypoints) and waypoints[-1].coord == coords:
del waypoints[-1]
waypoints.append(route)
else:
if waypoints[-1].coord != coords:
waypoints.append(Wpoint(coords))
I don't know Python. However, does "waypoints[-1]" mean the waypoint element before the current one?
|
Top
|
|
|
|
#187963 - 03/11/2003 21:46
Re: Is this a bug in GPSapp or the python script?
[Re: tfabris]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
I know that either deleting the extra data point, or moving the turn instruction up to the first of the two data points, would correct the problem. But what about situations where I don't know that MapsOnUs has fed me this kind of data and it's in the player and it's now too late?
If they're literally the same I can probably make a quick patch to simply drop one. However, the Python should be fixed to really drop it, if it isn't.
Also, this brings up the point of what happens if you see e.g.
2774 -1955
2812 -1963
2813 -1964
2821 -1927
where you in fact have a quick "left" before a hard "right". It would be nice to assume it doesn't happen, or it's accurate when it does. Is it? I don't know.
|
Top
|
|
|
|
#187964 - 03/11/2003 22:00
Re: Is this a bug in GPSapp or the python script?
[Re: Daria]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
If they're literally the same I can probably make a quick patch to simply drop one. However, the Python should be fixed to really drop it, if it isn't.
--- route.c.~1.14.~ Mon Jan 27 11:29:28 2003
+++ route.c Mon Nov 3 22:57:08 2003
@@ -163,6 +163,11 @@
if (buf[len-1] == ' ') buf[--len] = '\0';
route.pts.x = strtol(p, &p, 10);
route.pts.y = strtol(p, &p, 10);
+ if (i && (route.pts.x == route.pts[i-1].x) &&
+ (route.pts.y == route.pts[i-1].y)) {
+ i--;
+ continue;
+ }
if (p < buf + len) {
if (j == route.nwps) {
err("Too many waypoints?");
Attachments
186674-gpsapp (286 downloads)
|
Top
|
|
|
|
#187965 - 04/11/2003 06:28
Re: Is this a bug in GPSapp or the python script?
[Re: Daria]
|
carpal tunnel
Registered: 20/12/1999
Posts: 31597
Loc: Seattle, WA
|
One thing I wanted to say... if one of the two points in question happens to have a turn instruction (as in my example above), there's no way to predict if the first or the second point will be the one that contains the turn instruction. So if any changes are made that delete duplicate waypoints, then one would need to make sure the turn instruction isn't lost.
|
Top
|
|
|
|
#187966 - 04/11/2003 08:38
Re: Is this a bug in GPSapp or the python script?
[Re: tfabris]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
One thing I wanted to say... if one of the two points in question happens to have a turn instruction (as in my example above), there's no way to predict if the first or the second point will be the one that contains the turn instruction. So if any changes are made that delete duplicate waypoints, then one would need to make sure the turn instruction isn't lost.
Nope. Read the python script.
|
Top
|
|
|
|
#187967 - 04/11/2003 09:14
Re: Is this a bug in GPSapp or the python script?
[Re: Daria]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
Actually I guess it would lose the road name. (If you read the script you'll see why the turn instruction doesn't matter)
I can fix it to retain the road name also, but not yet. Meeting...
|
Top
|
|
|
|
#187969 - 04/11/2003 13:49
Re: Is this a bug in GPSapp or the python script?
[Re: tfabris]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
I often don't care what I'm turning onto, only that I'm turning. I just map it out. It's an easy hack, I'll deal tonight.
|
Top
|
|
|
|
#187970 - 08/02/2004 14:19
Re: Is this a bug in GPSapp or the python script?
[Re: Daria]
|
carpal tunnel
Registered: 24/01/2002
Posts: 3937
Loc: Providence, RI
|
It looks like I never sent the diff from this back to Jan. I'll include it here for posterior. I mean, posterity
diff -u -r1.16 route.c
--- route.c 25 Mar 2003 23:00:58 -0000 1.16
+++ route.c 8 Feb 2004 20:15:59 -0000
@@ -165,6 +165,11 @@
if (buf[len-1] == ' ') buf[--len] = '\0';
route.pts .x = strtol(p, &p, 10);
route.pts.y = strtol(p, &p, 10);
+ if (i && (route.pts.x == route.pts[i-1].x) &&
+ (route.pts.y == route.pts[i-1].y)) {
+ i--;
+ continue;
+ }
if (p < buf + len) {
if (j == route.nwps) {
err("Too many waypoints?");
@@ -383,8 +388,10 @@
if (turn < 0.0) {
heading = "LEFT";
turn = -turn;
- } else
+ } else if (turn > 0.0) {
heading = "RIGHT";
+ } else
+ heading = "";
strong = turn > 130 ? "sharply " : "";
|
Top
|
|
|
|
|
|