This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Signalk / Issue resuming GPSD connection
#1
Dear All,

I would like to seek advices on an issue encountered with signalk NMEA0183 GPSD source.

I am feeding data from tinypilot to openplotter through signalk (version 1.40.0) :
  - Some NMEA0183 data (baro, temperature, wind direction and speed) by declaring a NMEA0183 source as TCP Client pointing to tinypilot on port 20220
    * 'No data timeout' is set to 10000 (unit is millisecond and not second according to the code found on github: https://github.com/SignalK/signalk-serve...0cb859de38)
  - GPS data by declaring a NMEA0183 source as GPSD pointing to tinypilot on port 2947
    * GPSD version on tinypilot: 3.23.1
    * 'No data timeout' has been set to 10000 (not sure about the time unit, assuming this is ms) and also experimented with 10 (assuming unit is second)
  - pypilot data through signalk automatic discovery

This setup works seamlessly until, for tests purpose, I reboot tinypilot :
  - The signalk automatic discovery resume properly after some delay (~10 to 12s, time for pypilot code to start)
  - The TCP Client source resume almost immediatley after reboot
  - The GPSD never resume ; the signalk server has to be restarted

There is no error reported by the GPSD source within 'Connection & Plugin Status' while reconnection retries error populate the NMEA TCP source.

Has someone already experimented with NMEA0183 source as GPSD and found a proper setup to resume the GPSD connection ?

Best regards,

Xavier.
Reply
#2
To all,

I have found a work around ; please fell free to comment as it is certainly not the most appropriate.

Idea:
 * Use local GPSD daemon on openplotter to retrieve the GPS (and potential AIS data) so that the connection to GPSD is never lost.
 * Concern : what happen if local GPSD loose the link to GPSD running tinycore
 * Solution : small batch called by systemd for keepalive (systemd rather than

Code:
/home/pi/gpsd_keepalive
#!/bin/bash

# GPSD Keep Alive
# Initiate a connection to remote GPSD and ensure this connection stay alive
# XT211214

# Variables
SOURCE=gpsd://192.168.20.199:2947

# Script
gpsdevices=`gpspipe -r -n 2 | sed -e '$!d' -e 's/.*\[\([^]]*\)\].*/\1/g'`
#echo $gpsdevices

if [ -n "$gpsdevices" ] && [[ "$gpsdevices" =~ "$SOURCE" ]]; then
 #echo "OK"
 true
else
 #echo "Missing $SOURCE"
 # Missing source
 /usr/sbin/gpsdctl remove "$SOURCE"
 /usr/sbin/gpsdctl add "$SOURCE"
fi

Code:
/etc/systemd/system/gpsd_keepalive.timer
[Unit]
Description=Timer for GPSD KeepAlive (to cope with GPSD via networks breaks)

[Timer]
OnBootSec=30s
OnUnitInactiveSec=5s
AccuracySec=1s

[Install]
WantedBy=timers.target

Code:
/etc/systemd/system/gpsd_keepalive.service
[Unit]
Description=GPSD Keep Alive (to cope with GPSD via networks breaks)
#Documentation=
After=network.target

[Service]
WorkingDirectory=/home/pi
User=root
ExecStart=/home/pi/gpsd_keepalive
Starting the services (in root):
  • systemctl start gpsd_keepalive.timer gpsd.keepalive.service
Xavier.
Reply
#3
Sk server should switch to using https://www.npmjs.com/package/node-gpsd-client that appears to support automatic reconnect.
Reply
#4
Hello Teppo,

Thanks a lot for the reply and the search for a node-gpsd client supporting reconnect (https://github.com/SignalK/signalk-server/issues/1363) ; that should avoid the use for the kind of workaround exposed above.

By the way, I noticed on signalk-server issues on GitHub some discussion about GPS returning wrong dates leading to a problem with set date and time plugin (https://github.com/SignalK/signalk-server/issues/1335) ; I tentatively suggested a possibility to use GPSD which incorporate patches to cope with the 2^10 week rollover leading to incorrect date being returned (documented https://gpsd.gitlab.io/gpsd/gpsd.html):
Quote:gpsd uses the startup time of the daemon detect and compensate for rollovers while it is running, but otherwise reports the date as it is reported by the receiver without attempting to correct it.
There was an issue with the code implementation for releases >=3.20 (see https://gitlab.com/gpsd/gpsd/-/issues/144) but has been corrected by Garry Miller in 3.23.1. I have recompiled GPSD V3.23.1. on tinypilot and openplotter and found with a 'buggy' GPS that does not take properly into account the rollover (BU-353 based on SiRF3) that correct date is now reported.

To finish with, thanks a lot to sk team for the great application and time dedicated to it ; really impressive.

Best regards,

Xavier.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)