与gpsd共享内存的python接口

gpsdshm的Python项目详细描述


概述

python gpsdshm提供只读(!)python接口到gpsd的共享内存。它提供了 一个单独的类Shm,将共享内存结构的字段公开为属性。这个 python gpsdshmapi是(松散地)基于gpsd版本3.16(api 6.1)建模的。GPSD早期版本 不支持3.0。

python gpsdshm使用Swig实现,需要gpsd头文件进行编译。

许多linux发行版都附带了gpsd包,但不支持共享内存。 有关如何构建gpsd的详细信息,请参见Compiling gpsd with shared memory support 支持共享内存。

示例

下面的示例显示了所有属性和典型值(位于窗口内约一米处的固定GPS的属性和典型值)。

>>>importgpsdshm>>>gpsd_shm=gpsdshm.Shm()>>>gpsd_shm.setTODO:<SwigObjectoftype'gps_mask_t *'at0x133bf50>>>>gpsd_shm.online# True if GPS is onlinegpsd_shm.onlineTODO:Out[6]:1454057376.6934643>>>gpsd_shm.status# Do we have a fix (True/False)?gpsd_shm.statusTODOOut[7]:1>>>gpsd_shm.skyview_time# Skyview timestamp>>>gpsd_shm.satellites_visible# Number of satellites in viewTODO:nan>>>gpsd_shm.fix.time# Time of update1454057448.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 uncertainty0.005>>>gpsd_shm.fix.latitude# Latitude in degrees (valid if mode >= 2)-37.75859333333334>>>gpsd_shm.fix.epy# Latitude position uncertainty, meters14.853882022256698>>>gpsd_shm.fix.longitude# Longitude in degrees (valid if mode >= 2)144.99911>>>gpsd_shm.fix.epx# Longitude position uncertainty, meters10.040781879264545>>>gpsd_shm.fix.alitude# Altitude in meters (valid if mode == 3)68.2>>>gpsd_shm.fix.epv# Vertical position uncertainty, meters19.55>>>gpsd_shm.fix.track# Course made good (relative to true north)44.45>>>gpsd_shm.fix.epd# Track uncertainty, degreesnan>>>gpsd_shm.fix.speed# Speed over ground, meters/sec0.3446777748>>>gpsd_shm.fix.eps# Speed uncertainty, meters/sec29.707764044513397>>>gpsd_shm.fix.climb# Vertical speed, meters/sec0.0>>>gpsd_shm.fix.epc# Vertical speed uncertaintynan>>>gpsd_shm.dop.xdop0.6693854586176363>>>gpsd_shm.dop.ydop0.9902588014837799>>>gpsd_shm.dop.pdop1.17>>>gpsd_shm.dop.hdop0.99>>>gpsd_shm.dop.vdop0.82>>>gpsd_shm.dop.tdop1.2548625723457216>>>gpsd_shm.dop.gdop2.4342743978108503

有关卫星的信息包含在satellites列表中。

>>>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 satellite6>>>gpsd_shm.satellites[0].elevation# Elevation of satellite, degrees56>>>gpsd_shm.satellites[0].azimuth# Azimuth, degrees59

使用共享内存支持编译gpsd

$ 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

然后运行start gpsd并检查共享段是否已创建。

$ 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

历史记录

0.1.0(2016年2月4日)

  • 初始版本

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java向嵌入式Jetty添加多个端点   java如何在JAXWS处理程序中区分请求和响应?   使用Scenebuilder for JAVAFx的登录应用程序的java MVC体系结构   java对话框将不显示   Windows 7上的Java系统变量   java删除动态添加的面板   java将Javadoc嵌入到HTML网站中   带有URL编码数据的java Spring RestTemplate POST请求   java JAXR只运行一次函数   HttpClient缺少java依赖项   java深层反射比较   基于javarmi和CORBA的分布式计算   如何使用当前数据库时间从Java更新MongoDB?   java通过光标保存数据调试时显示错误数据