Skip to main content

python-gpsdshm

Overview

python-gpsdshm provides a read-only(!) Python interface to gpsd’s shared memory. It provides a single class Shm that exposes the fields of the shared memory structure as attributes. The python-gpsdshm API is (loosely) modelled on gpsd version 3.16 (API 6.1). gpsd releases earlier than 3.0 are not supported.

python-gpsdshm is implemented using Swig and requires the gpsd header files for compilation.

Many Linux distributions ship the gpsd package without shared memory support. See Compiling gpsd with shared memory support for details how to build gpsd with shared memory support.

Example

The example below shows all attributes and typical values (of a stationary GPS, placed about one metre inside a window).

>>> import gpsdshm
>>> gpsd_shm = gpsdshm.Shm()
>>> gpsd_shm.set
TODO: <Swig Object of type 'gps_mask_t *' at 0x133bf50>
>>> gpsd_shm.online               # True if GPS is online
gpsd_shm.online
TODO: Out[6]: 1454057376.6934643
>>> gpsd_shm.status               # Do we have a fix (True/False)?
gpsd_shm.status
TODO Out[7]: 1
>>> gpsd_shm.skyview_time         # Skyview timestamp
>>> gpsd_shm.satellites_visible   # Number of satellites in view
TODO: nan
>>> gpsd_shm.fix.time             # Time of update
1454057448.0
>>> gpsd_shm.fix.mode             # Mode of fix (0=not seen, 1=no fix, 2=2D, 3=3D)
3
>>> gpsd_shm.fix.ept              # Expected time uncertainty
0.005
>>> gpsd_shm.fix.latitude         # Latitude in degrees (valid if mode >= 2)
-37.75859333333334
>>> gpsd_shm.fix.epy              # Latitude position uncertainty, meters
14.853882022256698
>>> gpsd_shm.fix.longitude        # Longitude in degrees (valid if mode >= 2)
144.99911
>>> gpsd_shm.fix.epx              # Longitude position uncertainty, meters
10.040781879264545
>>> gpsd_shm.fix.alitude          # Altitude in meters (valid if mode == 3)
68.2
>>> gpsd_shm.fix.epv              # Vertical position uncertainty, meters
19.55
>>> gpsd_shm.fix.track            # Course made good (relative to true north)
44.45
>>> gpsd_shm.fix.epd              # Track uncertainty, degrees
nan
>>> gpsd_shm.fix.speed            # Speed over ground, meters/sec
0.3446777748
>>> gpsd_shm.fix.eps              # Speed uncertainty, meters/sec
29.707764044513397
>>> gpsd_shm.fix.climb            # Vertical speed, meters/sec
0.0
>>> gpsd_shm.fix.epc              # Vertical speed uncertainty
nan
>>> gpsd_shm.dop.xdop
0.6693854586176363
>>> gpsd_shm.dop.ydop
0.9902588014837799
>>> gpsd_shm.dop.pdop
1.17
>>> gpsd_shm.dop.hdop
0.99
>>> gpsd_shm.dop.vdop
0.82
>>> gpsd_shm.dop.tdop
1.2548625723457216
>>> gpsd_shm.dop.gdop
2.4342743978108503

Information about satellites is contained in the satellites list.

>>> gpsd_shm.satellites[0].ss         # Signal-to-noise ratio (dB)
16.0
>>> gpsd_shm.satellites[0].used       # Used in solution?
False
>>> gpsd_shm.satellites[0].prn        # PRNs of satellite
6
>>> gpsd_shm.satellites[0].elevation  # Elevation of satellite, degrees
56
>>> gpsd_shm.satellites[0].azimuth    # Azimuth, degrees
59

Compiling gpsd with shared memory support

$ git clone git://git.sv.gnu.org/gpsd.git   # git clone http://git.savannah.gnu.org/r/gpsd.git
$ cd gpsd
$ git tag
$ git checkout release-3.16
$ scons prefix=/usr/local shm_export=yes
$ sudo scons install

Then run start gpsd and check whether the shared segment has been created.

$ sudo /usr/local/sbin/gpsd -n /dev/ttyAMA0
$ ipcs -m | grep 0x47505344
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x47505344 163844     root       666        31616      1

History

0.1.0 (04-Feb-2016)

  • Initial version

Metadata

Release files for gpsdshm 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpsdshm 0.1.1
File Size Uploaded Provenance Actions
gpsdshm-0.1.1.tar.gz 50.8 kB Without provenance Details for gpsdshm-0.1.1.tar.gz

Release files / gpsdshm-0.1.1.tar.gz

Download URL gpsdshm-0.1.1.tar.gz
Size 50.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8efa9ff0936d66b872dbfbc3f13f6fda5f236a95b3856e4db7bf5d94c5e27050
BLAKE2b-256 checksum
How to use checksums
3bfadf1b2e54a5ad1630c285fbf1a079badc0e1ef7bb35213f9715f851044f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gpsdshm 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page