pepito
pepito

Reputation: 91

GPS Week Number Rollover (WNRO) and gpsd

I'm looking for a solution to fix 'old' gps with the week number rollover problem.

So I created a python script "fix_gpsrollover.py" to rewrite the nmea RMC tag to fix the date.

    if line.startswith('$GPRMC'):
        rmc_data = line.split(separator)
        if len(rmc_data) > 10:
            date = rmc_data[9]
            corrected_date = (datetime.strptime(date, '%d%m%y') + timedelta(days=1024*7)).strftime('%d%m%y')
            rmc_data[9] = corrected_date
            rmc_line = calculate_checksum(separator.join(rmc_data))

So I'm able to start manually gpsd to take fixed stream.

$ cat /dev/ttyACM3 | python fix_gpsrollover.py | gpsd -n -N /dev/stdin

I would like to setup correctly gpsd service to take this, I would like to use standard configuration files '/etc/default/gpsd'

Any ideas ?

Upvotes: 0

Views: 577

Answers (1)

pepito
pepito

Reputation: 91

I managed to use the output of my script to be the input of gpsd.

A start a script with supervisord at boot time.

command=bash -c "tail -f /dev/ttyACM3 | python /home/####/fix_gpsrollover.py | nc -l localhost 42991"

and in /etc/default/gpsd

DEVICES="tcp://localhost:42991"

of course the port 42991 can be changed as you prefer

Upvotes: 0

Related Questions