Ultimate GPS + Raspi

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
dronshaw
 
Posts: 3
Joined: Thu Feb 28, 2013 11:37 pm

Ultimate GPS + Raspi

Post by dronshaw »

So I've run into a snag on getting data from the ultimate GPS. Right now I'm running the latest wheezy on my pi. I'm able to cgps -s fine and see the real-time data. Unfortunately, I'm having problems implementing the code they recommend:

""Now that you're GPS is up and running, and gpsd is playing nice with it, it's time to do something with the data!

The easiest way to get started is using the WebIDE and a bit of python code to access gpsd.

Create a new file in the WebIDE, and then add and run the following code:
Copy Code

import gps

# Listen on port 2947 (gpsd) of localhost
session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)

while True:
try:
report = session.next()
# Wait for a 'TPV' report and display the current time
# To see all report data, uncomment the line below
# print report
if report['class'] == 'TPV':
if hasattr(report, 'time'):
print report.time
except KeyError:
pass
except KeyboardInterrupt:
quit()
except StopIteration:
session = None
print "GPSD has terminated"
"

Since I don't have WebIDE, I create a gps.py file in /home/pi. I paste the code and then try "python gps.py" and get

Traceback (most recent call last):
File "gps.py", line 1, in <module>
import gps
File "/home/pi/gps.py", line 4, in <module>
session = gps.gps("localhost", "2947")
TypeError: 'module' object is not callable


I'm VERY new to the pi/python/programming, so I hope I'm not making a stupid silly mistake, but I believe this is how you would implement this without WebIDE.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”