GPSD Integration problems
client ansible version 1.8.1 on network-dev on a rpi4.
/etc/default/satnogs-client
SATNOGS_GPSD_CLIENT_ENABLED=True
SATNOGS_GPSD_HOST=127.0.0.1
SATNOGS_GPSD_PORT=2947
SATNOGS_GPSD_TIMEOUT=30
USB gps puck connected as /dev/ttyUSB0 /etc/default/gpsd
GPSD_OPTIONS="-b -s 4800"
First off, the default timeout should not be 0 as this blocks the client if the gpsd has issues.
The relevant code here One problem is the LOGGER crashing when height is not reported as a number:
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: --- Logging error ---
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: Traceback (most recent call last):
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/logging/__init__.py", line 1079, in emit
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: msg = self.format(record)
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/logging/__init__.py", line 923, in format
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: return fmt.format(record)
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/logging/__init__.py", line 659, in format
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: record.message = record.getMessage()
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/logging/__init__.py", line 363, in getMessage
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: msg = msg % self.args
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: ValueError: cannot convert float NaN to integer
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: Call stack:
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/threading.py", line 912, in _bootstrap
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: self._bootstrap_inner()
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: self.run()
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/threading.py", line 892, in run
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: self._target(*self._args, **self._kwargs)
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/concurrent/futures/thread.py", line 77, in _worker
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: work_item.run()
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: result = self.fn(*self.args, **self.kwargs)
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/var/lib/satnogs/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: retval = job.func(*job.args, **job.kwargs)
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/var/lib/satnogs/lib/python3.9/site-packages/satnogsclient/scheduler/tasks.py", line 176, in get_jobs
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: gps_locator.update_location()
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: File "/var/lib/satnogs/lib/python3.9/site-packages/satnogsclient/locator/locator.py", line 35, in update_location
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: LOGGER.info('Last coordinates %f %f %d', settings.SATNOGS_STATION_LAT,
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: Message: 'Last coordinates %f %f %d'
Jan 18 21:18:49 raspi-sat2 satnogs-client[389]: Arguments: (63.837188333, 20.173745, nan)
I changed that line locally so it wouldn't crash:
LOGGER.info('Last coordinates %f %f', settings.SATNOGS_STATION_LAT,settings.SATNOGS_STATION_LON)
The GPS currently communicates and doesn't have a location. It looks like the client have trouble checking the scheduler as the "last seen" on the dashboard can show several minutes ago.
Jan 19 09:21:18 raspi-sat2 systemd[1]: Started SatNOGS client.
Jan 19 09:21:21 raspi-sat2 satnogs-client[900]: satnogsclient - INFO - Starting status listener thread...
Jan 19 09:21:21 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Last coordinates 63.854000 20.208000
Jan 19 09:21:21 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Connecting to GPSD 127.0.0.1:2947
Jan 19 09:21:21 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 30s)
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - GPS timeout, using last known coordinates
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Starting scheduler...
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Registering `get_jobs` periodic task (60 sec. interval)
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Registering `post_data` periodic task (60 sec. interval)
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Last coordinates 63.854000 20.208000
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Connecting to GPSD 127.0.0.1:2947
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient - INFO - Press Ctrl+C to exit SatNOGS poller
Jan 19 09:21:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 30s)
Jan 19 09:22:22 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - GPS timeout, using last known coordinates
Jan 19 09:22:22 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Trying to GET observation jobs from the network
Jan 19 09:22:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Last coordinates 63.854000 20.208000
Jan 19 09:22:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Connecting to GPSD 127.0.0.1:2947
Jan 19 09:22:52 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 30s)
Jan 19 09:22:52 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Post data started
Jan 19 09:23:22 raspi-sat2 satnogs-client[900]: satnogsclient.locator.locator - INFO - GPS timeout, using last known coordinates
Jan 19 09:23:22 raspi-sat2 satnogs-client[900]: satnogsclient.scheduler.tasks - INFO - Trying to GET observation jobs from the network
Even worse is when the gpsd doesn't get data from the gps device, either bad config or auto detecting baudrate etc. Then the client just stop polling:
Jan 18 20:55:08 raspi-sat2 satnogs-client[382]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 10s)
Jan 18 20:56:08 raspi-sat2 satnogs-client[382]: apscheduler.scheduler - WARNING - Execution of job "get_jobs (trigger: interval[0:01:00], next run at: 2023-01-18 20:56:08 UTC)" skipped: maximum number of running instances reached (1)
Jan 18 20:56:08 raspi-sat2 satnogs-client[382]: satnogsclient.scheduler.tasks - INFO - Post data started
When it's working it looks something like this:
Jan 19 10:08:28 raspi-sat2 satnogs-client[979]: satnogsclient.scheduler.tasks - INFO - Post data started
Jan 19 10:08:40 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Updating coordinates 63.837942 20.174735 81
Jan 19 10:08:40 raspi-sat2 satnogs-client[979]: satnogsclient.scheduler.tasks - INFO - Trying to GET observation jobs from the network
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Last coordinates 63.837942 20.174735
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Connecting to GPSD 127.0.0.1:2947
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 30s)
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.scheduler.tasks - INFO - Post data started
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Updating coordinates 63.836102 20.172658 82
Jan 19 10:09:28 raspi-sat2 satnogs-client[979]: satnogsclient.scheduler.tasks - INFO - Trying to GET observation jobs from the network
Jan 19 10:10:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Last coordinates 63.836102 20.172658
Jan 19 10:10:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Connecting to GPSD 127.0.0.1:2947
Jan 19 10:10:28 raspi-sat2 satnogs-client[979]: satnogsclient.locator.locator - INFO - Waiting for GPS (timeout 30s)
Relevant issue/MR: !389 (merged) #327 (closed)