{"id":48332920,"url":"https://github.com/saradaabura/pygps2","last_synced_at":"2026-04-05T01:10:31.578Z","repository":{"id":282028010,"uuid":"947237479","full_name":"saradaabura/pygps2","owner":"saradaabura","description":"Analyze almost every sentence.","archived":false,"fork":false,"pushed_at":"2026-03-26T06:20:22.000Z","size":221,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-27T01:55:57.017Z","etag":null,"topics":["gnss","gps","parser","pygps2","python"],"latest_commit_sha":null,"homepage":"https://qiita.com/raspico/items/2c4d4d3308c841006fa2","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saradaabura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-12T11:20:59.000Z","updated_at":"2026-03-26T06:20:26.000Z","dependencies_parsed_at":"2025-06-10T13:32:57.870Z","dependency_job_id":null,"html_url":"https://github.com/saradaabura/pygps2","commit_stats":null,"previous_names":["saradaabura/pygps2"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/saradaabura/pygps2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saradaabura%2Fpygps2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saradaabura%2Fpygps2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saradaabura%2Fpygps2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saradaabura%2Fpygps2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saradaabura","download_url":"https://codeload.github.com/saradaabura/pygps2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saradaabura%2Fpygps2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31420790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T00:25:07.052Z","status":"ssl_error","status_checked_at":"2026-04-05T00:25:05.923Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gnss","gps","parser","pygps2","python"],"created_at":"2026-04-05T01:10:30.936Z","updated_at":"2026-04-05T01:10:31.565Z","avatar_url":"https://github.com/saradaabura.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# Japanese\n# pygps2\nこのライブラリは自由に使用してください。\n\n![IMG_20260215_113919721 (1)](https://github.com/user-attachments/assets/5637aa1f-178d-46ff-b375-fa0fd419bc30)\n# バージョン情報\nhttps://github.com/saradaabura/pygps2/blob/master/Version.md\n\n# 依存ライブラリ (micropython)\n- micropython-decimal-number (設定により依存)\n\n### Raspberry Pi PicoやESP32・RPi4などのMicroPython・CPython向けのGPS/NMEA解析ライブラリです。\n### 通常のPythonに対応(CPython)しているため、WindowsやLinuxなどの環境でも使用できます。\n# 対応センテンス\n基本的にすべてのセンテンスに対応しています。\n```\nGGA:$GNGGA, $GPGGA, $BDGGA\nGLL:$GNGLL, $GPGLL, $BDGLL\nGSA:$GNGSA, $GPGSA, $BDGSA\nGSV:$GPGSV, $BDGSV, $GQGSV, $GLGSV, $GAGSV, $GBGSV\nRMC:$GNRMC, $GPRMC, $BDRMC\nVTG:$GNVTG, $GPVTG, $BDVTG\nGST:$GNGST, $GPGST, $BDGST\nDHV:$GNDHV, $GPDHV, $BDDHV\nZDA:$GNZDA, $GPZDA, $BDZDA\nTXT:$GNTXT, $GPTXT, $BDTXT\n```\n\n# MicroPythonでの使い方\nexamples/for_micropython.py環境にあったサンプルコード(Raspberry Pi Pico用)があります。\n**サンプルを実行し、環境で動作を確認してからプログラムをつくることをおすすめします。**\n\n# CPythonでの使い方\nexamples/for_cpython_example.pyというサンプルコード(Windows用)を使います。\n**サンプルを実行し、環境で動作を確認してからプログラムを制作することをおすすめします。**\n```python:main.py\nimport threading\nimport serial\nimport time\nfrom pygps2 import pygps2\n\nclass GPSReader:\n    def __init__(self, port=\"COM6\", baud=460800):\n        self.port = port\n        self.baud = baud\n        self.running = False\n        self.thread = None\n        self.gps = pygps2()\n        self.lock = threading.Lock()\n    def start(self):\n        self.running = True\n        self.thread = threading.Thread(target=self._loop, daemon=True)\n        self.thread.start()\n    def stop(self):\n        self.running = False\n        if self.thread:\n            self.thread.join()\n    def _loop(self):\n        try:\n            ser = serial.Serial(self.port, self.baud, timeout=1)\n        except Exception as e:\n            print(\"Serial open error:\", e)\n            return\n        print(f\"[GPSReader] Reading {self.port} @ {self.baud}\")\n        while self.running:\n            try:\n                line = ser.readline().decode(errors=\"ignore\").strip()\n                if not line:\n                    continue\n                with self.lock:\n                    self.gps.analyze_sentence(line)\n            except Exception as e:\n                print(\"Error in GPS thread:\", e)\n        ser.close()\n        print(\"[GPSReader] Stopped\")\n    def get(self, key):\n        with self.lock:\n            return getattr(self.gps, key, None)\nif __name__ == \"__main__\":\n    gps_reader = GPSReader(\"COM6\", 460800)\n    gps_reader.start()\n\n    try:\n        while True:\n            rmc = gps_reader.get(\"RMC\"); gsv = gps_reader.get(\"GSV\")\n            if rmc:\n                print(\"Lat:\", rmc[\"latitude\"], \"Lon:\", rmc[\"longitude\"])\n            if gsv:\n                print(\"GPS:\", gsv[\"GP\"][\"num_satellites\"] if gsv[\"GP\"] else 0,\n                      \"BD:\", gsv[\"GB\"][\"num_satellites\"] if gsv[\"GB\"] else 0,\n                      \"GA:\", gsv[\"GA\"][\"num_satellites\"] if gsv[\"GA\"] else 0)\n\n            time.sleep(1)\n\n    except KeyboardInterrupt:\n        print(\"Stopping...\")\n        gps_reader.stop()\n```\nSerialのポートとボーレートは環境に合わせて変更してください。\n\n# 動作確認済み環境\n- CPython (Python3.14)\n- Windows11 Linux(Raspberry Pi Zero 2W with DietPi)\n- Raspberry Pi Pico 2\n- MicroPython v1.24.1 on 2024-11-29; Raspberry Pi Pico2 with RP2350\n- MicroPython v1.27.0 on 2025-12-09; Raspberry Pi Pico2 with RP2350\n- ESP32-DevKitC-VE ESP32-WROVER-E開発ボード 8MB\n- MicroPython v1.27.0 on 2025-12-09; Generic ESP32 module with SPIRAM with ESP32\n- GPSモジュール: AT6668 (M5Stack GPSモジュールv1.1)\n- GPSモジュール: AT6558 (Air530Z)\n- GPS受信機: GT-505GGBL5-DR-N(秋月電子)\n\nジェネリック\n- Python3 serialが使えること\n- NMEA0183をUARTで受信できること\n\n**マシンパワーがあまりにも低いと解析できないおそれはある。(マイコンでは動くのでCpyでも大丈夫だと思う)**\n# 問題\n- 速いボーレートでは処理が追いつかず、すべて解析できないことがある。推奨は115200bps\n- ESP32だと処理が追いつかず、センテンスを解析できない。たまに解析できる。bufの問題だと思う。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaradaabura%2Fpygps2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaradaabura%2Fpygps2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaradaabura%2Fpygps2/lists"}