Last week, I wrote a short Python script that uses a USB GPS device under Linux to help with navigation. It doesn’t have maps or anything — it just gives distances and, while you’re moving, the direction to the destination (as in “two o’clock”). It prints this info on the terminal and speaks it using speech synthesis.
I joked about this in Comic #407, but it’s actually a pretty practical way to get around. Just knowing what direction something’s in is a huge step toward finding it. This past week I’ve used it successfully to find my way around towns I don’t know, and we even used it while driving to navigate to an out-of-town destination.
Plus, there’s the bonus that when you’re walking, wearing an earpiece, laptop in the bag, listening to the computerized voice whisper “TARGET DIRECTION THREE O’CLOCK DISTANCE ONE POINT THREE KILOMETERS ETA FIFTEEN MINUTES” into your ear, you feel like a cyborg. I’ll have to set it up with a female voice and rename it “jane.py”.
Edit: I’ve just been testing the recent changes to this script, and it’s really not in a condition where I should be posting it anywhere. But if you can use it as a starting point for hacking, here’s the link. Some of you might find it useful sometime soon.
Vid or it didn’t happen.
Heh, that’s actually a pretty entertaining concept. I’ve been looking into getting a USB GPS for my Debian system for awhile now, and this is icing on the cake.
What are you running this on? Are you carrying around an Eee PC in a bag or something and listening through the headphones? Also, I see that the program requires figlet. What are you using figlet for, just printing the directions in a big type?
This really sounds awesome. If I had a device running linux which I could carry around (pocket-size, preferably), I would TOTALLY use this as a combined iPod/find-my-way-around device.
A few years ago on a trip to Houston, I used a Pocket PC with Compact Flash GPS running some navigation software.
I didn’t want to wander around holding the PPC in my hand, so I experimented with the PPC in my pocket, and an earpiece. I could hear the directions as I was walking around, without having to look at anything.
http://dudegalea.co.uk/?p=5
However, the drawback was that the software didn’t really understand what it meant to be a pedestrian, so if I was in a park (for example) it gave me stupid directions.
Your solution, with the simple clock instructions sounds like a neat idea.
let us know when you come up with a death laser implant or something
> What are you running this on? Are you carrying around an Eee PC in a bag or something and listening through the headphones? Also, I see that the program requires figlet. What are you using figlet for, just printing the directions in a big type?
It uses figlet to print the directions in large type, yeah. And I used it by sticking my EEE-sized laptop in my backpack.
When the GPS gives you the general direction and not the navigation data, it feels like you are traveling in the see or in the desert but it is still very useful :)
A couple of obvious points: you must have used some maps to create the route in the first place.
And as said above, does one need to take the laptop along to the expedition?
> you must have used some maps to create the route in the first place.
From what I gather, it doesn’t really have a route as such… just gives the direction and distance as the crow flies… “You’re here, it’s there, which is sorta in that direction, c’mon, you can figure it out”.
If Grand Theft Auto has taught me anything it’s that I wouldn’t be able to navigate using this system.
> From what I gather, it doesn?t really have a route as such? just gives the direction and distance as the crow flies? ?You?re here, it?s there, which is sorta in that direction, c?mon, you can figure it out?.
It’s not a terrible point though. If you want to translate “Broadway and West 65th Street” into latitude and longitude, you need something like google maps. And if you have google maps, why not just write down the directions? Is that how you find out lat and long, Your Exalted Geekiness? (I think that’s a fitting title)
As über-geekery goes, it’s pretty neat, but it would be nicer if you didn’t need something like google maps first.
You don’t really need maps. Having used handheld GPS constantly for two years now geocaching, I can say that I very quickly got the hang of taking distance & direction and adapting it to the available trails, sidewalks or highways I can see. You never get very far astray. Unlike constructed mazes, human-usable routes are actually laid out with the general goal of enabling you to get there, wherever ‘there’ happens to be :)
@Oskar – yes you need Lat & Long for your goal but you can get that from a web-enabled phone in a pinch.
…or txt someone who’s near a browser
LOL
So Randall – the reason I came to comment, four posts later: Are you implying that a soon-to-be done cartoon will contain another GPS clue (a`la Dream Girl)?
heh, excellent idea. if i knew any python i’d get to playing around with this right away… since i don’t, i’ll have to learn before i start :P
i’m thinking waypoints as a useful feature – particularly for long journeys involving, for instance, a river or harbour – straight-line directions won’t cut it there, and telling the script that you need to go via point x first would be handy. similarly for a two-part journey such as picking someone up on the way to somewhere else.
also, lol at the jane reference there. 6 months ago that would have flown over my head, but no longer :D
I used to do this anyway, before I got my TomTom. I had a Garmin GPS12 and I used to enter the Lat/Long and mount it on my dash, then keep an eye on the bearing and distance. OK, it’s not always perfect because sometimes there are large obstacles that can confuse you (e.g. a big one-way system), but most of the time it works just fine. The main reason I prefer a full satnav when driving is the safety aspect – peering at a small LCD was always slightly risky. But I can see the attraction of the spoken version when walking – that really would be cool!
Thinking of getting this running on N95, fits in my pocket a little better than my laptop, now if i could only output a HUD to some glasses, hmmmm
I just had a quick look at your code.. it’s not too bad :)
One major issue (and a pet-peeve of mine :) is that you use
“# Main program starts here” instad of the massively more useful ‘if __name__ == “__main__”:’. This construct allows you to not only use your module in interactive mode (in which case __name__ is __main__) but also to import it as a module without problems (e.g.: import cyborg; cyborg.mps2mph(…)).
(see: http://docs.python.org/lib/module-main.html)
Maybe a more useful reference:
http://docs.python.org/tut/node8.html#SECTION008110000000000000000
Hey Randall, what’s at 37.355451,-121.959123?
have you read the somewhat related wired article from a few months back?
http://www.wired.com/wired/archive/15.04/esp.html?pg=1&topic=esp&topic_set=
Very interesting stuff. Take a look at the warning at the end; I find it both scary and fascinating:
“When the original [...] experiment ended, Wächter, the sysadmin who started dreaming in north, says he felt lost; [...], his brain had remapped in expectation of the new input. “Sometimes I would even get a phantom buzzing.” He bought himself a GPS unit, which today he glances at obsessively. One woman was so dizzy and disoriented [...] that her colleagues wanted to send her home from work. “My living space shrank quickly,” says König. “The world appeared smaller and more chaotic.”
Bonus points if instead of “kilometers” it says “klicks”.
@David :
Let me guess: you live in the US.
I challenge you to do the same thing in France. We love our little streets not straight, going sligthly round but not completely, crossing randomly, with a mixture of one way streets. There is no way knowing direction and distance can help you within that maze. But GPS can
Pittsburgh, PA would be a tad frustrating for general navigation because of all the hills and rivers. Even maps can be misleading, as I found myself walking up a rather steep hill to get to the bus station, only to realize a few moments later that I had to find some way down the cliff and across the Interstate at the same time. (In this case, there were stairs and a pedestrian bridge, but they were half a mile away.)
Incidentally, Geocaching, a hobby I’ve had for six years now, is essentially based on just this type of navigation. You may want to check it out.
> There is no way knowing direction and distance can help you within that maze. But GPS can
et. al.
This is, basically, a speaking compass (okay, and DME). Its basic, but very useful and functional navigation. People got around just fine before GPS.
In fact, I see so many people who cannot navigate that maybe there should be graduated licensing for GPS. You have to use the direction and distance mode for 25 trips before you can use route mapping.
@Bluebird: You’re on. Just arrange our relocation and work visas and I will gladly take up the challenge. We should be readily employable. We both already have some French and would be happy to take a 4-6 weeks immersion course to top it up. I am a CISSP working in ITSec and my wife is a commercial construction Project Engineer and OSHA-trained safety monitor.
When can we expect the tickets?
( :> )
Pilots will obviously like it .. Unless they have too much other stuff to listen
Any plans for supporting Linux-compatible bluetooth GPS devices? This would be relevant to my interests…
Needs a sexy fembot voice.
This sounds like an awesome application for Google’s Android – too bad they only allow python…
Bear in mind that Randall is not some zombie doing an automated tree-traversal in the hope of getting to his destination. Or so one hopes. Instead, he surely uses his learned database of how cities, roads, bridges, and such are typically arranged to do a recursive approximation of the best route.
Mind you, the idea of him getting in a cab and shouting “Take me to… THAT WAY!” ala Invader Zim is pretty entertaining. The day his Python scripted laptop achieves enough AI to prefer cupcakes to guidance systems he’ll be in trouble, though.
I wonder if Summer Glau could sell recordings of her voice for purposes like this? One might be able to piece together something useful from captures off of Firefly and Sarah Connor chronicles.
> I’ll have to set it up with a female voice and rename it “jane.py”.
Win.
Handy, your destination is 2 meters in front of you, but also 100 meters lower/higher…
How to handle that?
I don’t want to seem like a fool for possibly not getting this whole Jane thing or for being obvious about actually getting it. Therefore I will give information about what I think I’m meant to get and anybody else who gets it can put me out of my misery. Please. Is there a Gate Over The River?
Hey Randall, you should have a read of PEP 8 (http://www.python.org/dev/peps/pep-0008/), the style guide for Python coders, or other Pythonistas may not want to look at your code ;). For example, use spaces around the “=” and operators, don’t use parentheses for the if condition.
Some general tips for your Python code:
Have a look at the enumerate function, which can be used for looping over the index and the element of iterators, maybe you can get rid of some combinations of range, len and [i].
You can loop over the lines of a file, just like this (no need for readline): for line in open(path, ‘r’): print line
In the loganize function, you can use a list comprehension which is much clearer than the while:
current_time = history[-1][0] – time
return [entry for entry in history if entry[0] >= current_time]
@Umbrae:> what’s at 37.355451,-121.959123?
That’s a store near my apt where we were testing this :)
Is that a Speaker for the Dead reference? Great.
But I think it would be cool if you could make it into an ear piece, with the female voice and all.
HA HA OH WOW.
This sounds like the feelspace belt. A feelspace belt uses a digital compass to determin which way is north then uses a belt of pager vibrators to output the direction. It works by exploiting neuroplasticity.
I’m actual building one myself.
wired article
http://www.wired.com/wired/archive/15.04/esp.html
feelspace website
http://feelspace.cogsci.uos.de/en/technology_01.html
a useful page
https://bandgap.rsnsoft.com/mediawiki/index.php/Compass_Belt
For full jane-ification, add voice recognition that can search google maps for the coordinates.
Or forget jane and make it talk like glados.
Ooo no wait, for some real fun, have the target coordinates constantly uploaded from a friend’s GPS.
The hunt is on. Parkor ensues.
Ooo no wait, have the target coordinates constantly updated from friend’s GPS on a similar setup.
The hunt is on. Parkor ensues.
Oh my. It seems that Randall took my last comment a tad too seriously…
I just sat down and read 300 pages of Speaker today before I saw this post. I had forgotten what a huge crush I used to have on Jane. The prospect of having some semblance of a Jane following me around is driving me wild. I must have it!
Ender was not a cyborg.
<3
> I’ll have to set it up with a female voice and rename it “jane.py”.
But wouldn’t you feel horribly guilty whenever you turn it off?
It took me a little bit to find this article, but it is similar, and extremely interesting:
http://www.wired.com/wired/archive/15.04/esp_pr.html
Great, ok, now I’m ganna have to code a Jane simulator that I can take with me everywhere… you happy? Lol, probably won’t make it far, but it’d be cool. Like put a mac os on an ipod or something along those lines and have it run a simulator. If you could incorporate speech recognition into it that would make it so much cooler as well.. Maybe I’ll start with trying to just make one that sits on my desktop or something… if I don’t put it aside and forget about it like I always do that is…
Jane was so cool, and yea, it would be weird to turn her off (no pun intended) but I guess I’ll have to make it so she forgives you if u ask nice enough. But I guess that sorta defeats the purpose of Jane because she went beyond programming. =\
The trick is going to be to get this program working on hacked phones or something. This is fucking awesome though.
“Bonus points if instead of “kilometers” it says “klicks”.”
Or indeed Smoots.