0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Raspberry Piでcgpsの緯度経度が更新されない問題

Last updated at Posted at 2025-01-25

背景

以下のRaspberry Piフォーラムと全く同じ問題が起きていた。

u-bloxのGPSモジュールを付けて、cgps -sで緯度経度を取得しようとしても値を更新してくれない。一方、gpsmonコマンドで表示する場合は、LTP Pos(曲率を無視した座標系)が継続的に更新されていた。

Pythonコード経由でGPS緯度経度を取得しようとしても、cgps -sと同じ値のまま更新されず使えなかった。NMEAストリームは正しく流れていた。

解決した方法

何らかの理由で、単純にソケットがdisableになっていたことが原因だった。

sudo systemctl status gpsd.socket

上記のコマンドで inactive (dead) と表示された場合、以下を実行することで解決できる。

sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket

備考

今回の問題とは関係ないが、屋内でGPS信号が十分に取得できず、屋外に移動しても緯度経度が0.0のまま変わらない場合は、以下の再起動で治ることがある。(今思えばこの過程の中で気付かずdisableにしてしまった可能性がある)

sudo systemctl stop gpsd.socket
sudo gpsd /dev/ttyACM0 -F /var/run/gpsd.sock

1

  1. ttyACM0の部分は、GPSモジュールのポートによってttyUSB0などに変更する

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?