[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-users] Python3 Interface to GPSD
From: |
Moe |
Subject: |
[gpsd-users] Python3 Interface to GPSD |
Date: |
Tue, 8 Mar 2016 11:16:28 +1100 |
I am writing a Python 3 interface to GPSD.
https://github.com/wadda/gps3/blob/master/gps3.py
"""
GPS3 (gps3.py) is a Python 2.7-3.5 GPSD interface (http://www.catb.org/gpsd)
Defaults host='127.0.0.1', port=2947, gpsd_protocol='json'
GPS3 has two classes.
1) 'GPSDSocket' to create a socket connection and retreive the output from GPSD.
2) 'Fix' unpacks the streamed gpsd data into python dictionaries.
These dictionaries are populated from the JSON data packet sent from the GPSD.
Import import gps3
Instantiate gps_connection = gps3.GPSDSocket(host='192.168.0.4')
gps_fix = gps3.Fix()
Iterate for new_data in gps_connection:
if new_data:
gps_fix.refresh(new_data)
Use print('Altitude = ',gps_fix.TPV['alt'])
print('Latitude = ',gps_fix.TPV['lat'])
Consult Lines 153-ff for Attribute/Key possibilities.
or http://www.catb.org/gpsd/gpsd_json.html
Run human.py; python[X] human.py [arguments] for a human experience.
"""
While it's rudimentarily functional, I'm looking for constructive feedback.
As a gpsd user, if you have time, please have a look and tell me what you think
by any means you think is appropriate.
The showcase script to demo the gps3 interface is
https://github.com/wadda/gps3/blob/master/human.py
Thank you for your time and attention in this matter.
--
Moe <address@hidden>
- [gpsd-users] Python3 Interface to GPSD,
Moe <=