CLI GPSD客户端
gpsd-pindrop的Python项目详细描述
针滴管
在
要求
- gpsd公司
- gps dongle
设置
我用这个工具在一辆旧车上追踪它的位置。但是,它可以用于许多应用程序!这只是gpsd-py3库的命令行包装器,实际上它是一个gpsd客户机库。Gpsd是处理来自调制解调器的串行通信的服务器,并且仍然必须设置为这样。有很多教程可以设置gpsd,here是我觉得很有用的一个。在
成功设置gpsd后,安装pindrop的依赖项。在
用pip安装:pip3 install gpsd-pindrop
或者
克隆此存储库并运行:pip3 install -r requirements.txt
操作
usage: pindrop.py [-h] [--loc] [--lat] [--lon] [--daemon] [--conf CONF]
[--map] [--alt] [--speed] [--host HOST] [--port PORT]
[--climb] [--sats] [--track] [--movement] [--vertspeed]
[--error] [--device] [--weather] [--addr] [-v] [-a]
CLI GPSD Client
optional arguments:
-h, --help show this help message and exit
--loc get location as lat/lon pair
--lat get latitude in decimal format
--lon get longitude in decimal format
--daemon use daemon mode
--conf CONF config for daemon mode
--map get link to your location on a map
--alt get altitude in meters
--speed get speed in m/s
--host HOST host to connect to (default: 127.0.0.1)
--port PORT port to connect to (default: 2497)
--climb get climb in m/s
--sats get number of satellites currently visible
--track get course over ground, degrees from true north
--movement Get the speed and direction of the current movement
--vertspeed Get the vertical speed
--error get error estimates of readings, 95 percent confidence
--device get gps device information
--weather get weather at location (requires internet)
--addr get geocoded address from lat/lon (requires internet)
-v, --verbose increase verbosity
-a, --all display all location information
display all location information
守护程序模式
通过使用--daemon标志,您可以使用这个工具定期查询和存储来自gpsd的信息。使用配置.json作为模板存储在该repo的根级别。需要传递配置。在
示例
^{pr2}$默认配置
这些是默认选项,如果需要,应该用自定义配置替换。如果不需要,则应在“输出选项”列表中删除“类型”。在
在使用之前删除所有注释
{'period':30# every number in seconds to check gpsd'sqlite_db':'/data/pindrop/pindrop.sqlite',#path for sqlite file'output_dir':"/data/pindrop",# data directory'output_types':['json','sqlite','kml'],'kml_line_mode':false,#connect the logged points as a linestring in the kml file, if included in output types'exception_period':2,# seconds to wait before querying the gps again in case of low mode/failed call'naming_pattern':"%Y%m%d",# strftime naming pattern, sets how often files rotate'logging':[# Possible Options"location","longitude","latitude","altitude","hspeed","vertspeed","climb","track","movement","sats","error","timestamp","address",]}
输出示例:
对于以良好方式打印的所有可能的输出,请对所有输出使用-a标志
pi@carbox:~ $ pindrop -a
*****
*******
*** ***
*** ***
*** ***
*****
***
*
Pindrop
Lat,Lon:(30.337453049, -70.113382638)
Alt: 285.318m
Speed: 0.0m/s
Vertical Speed: 0m/s
Climb: 0.0m/s
Track: 0.0
Movement:
{'climb': 0.0, 'speed': 0.0, 'track': 0.0}
Device Information:
{'driver': 'SiRF', 'path': '/dev/ttyUSB0', 'speed': 4800}
Satellites Available: 12
Mode: 3
Percent Error Information:
{'c': 0.68, 's': 0.26, 't': 0.005, 'v': 29.011, 'x': 9.174, 'y': 11.076}
Time (UTC): 2020-02-17T16:16:43.000Z
Address:
123, Street, Town, County, State, Zip, Country
Weather:
Mist
_ - _ - _ - 33 °F
_ - _ - _ ↓ 0 mph
_ - _ - _ - 3 mi
0.0 in
View Here: http://www.openstreetmap.org/?mlat=30.337453009&mlon=-70.113382638&zoom=15
对于简洁的输出,省略详细标志并分别调用参数:
pi@carbox:~ $ pindrop --lat
30.337453049
路线图
完全包装gpsd-py3选项,包括所有函数和变量。- 允许多种输出模式(
json、csv、nmea、kml) 守护程序模式- restapi端点日志记录特性(将来将与我的另一个项目hq一起使用)
- HomeAssistant日志记录功能
- 数据库日志记录功能(
sqlite,postgres,mysql) 地理编码地址
提示
在我的例子中,我想在我的主机上开发,但是仍然使用我的raspberry pi上的gpsd服务器来获取信息。我用gpsd服务器为pi上的2497端口建立一个ssh隧道,然后我可以像服务器是本地服务器一样进行开发:
ssh -N -L 2947:localhost:2947 pi@10.0.0.17
您还可以更改gpsd的设置以使其他设备可以访问该端口,但这是一个更安全的选项,不会影响gpsd。在
捐款
- 在
请投稿!如果有错误,请告诉我--如果您能修复它,则会更好:)
在 - 在
非常感谢所有帮助过我们的人:
在
- 项目
标签: