Re: Doppler shift correction


Fortunately hamlib rigctl protocol is pretty basic.  Here is bare bones, basic, very quick and really dirty python3 hack that actually works. This accepts connection from gpredict on localhost port 4532 and makes REST API calls to sdrangel on localhost port 8091 - video of it actually working, the ssb modulator delta freq actually closely tracks the gpredict uplink doppler -  (video actually shows it backwards - corrected below, gpredict has +value and sdrangel -value)

#!/usr/bin/env python3
import socket
import json
import requests

# XW-2A  uhf uplink linear transponder middle 
basefreq = 435040000
deltafreq = 0 
api_url_base = ''
headers = {'Content-Type': 'application/json'}
api_url = '{0}sdrangel/deviceset/1/channel/0/settings'.format(api_url_base)
sock = socket.socket()
conn, addr = sock.accept()
while True:
  data = conn.recv(1024)
  #  F - set frequency
  if ( data.decode('UTF-8')[0] == 'F' ):
    freq = int(data.decode('UTF-8').split('  ')[1].strip())
    print('F: '+str(freq))
    conn.send(bytes('RPRT 0\n'.encode('UTF-8')))
    deltafreq = freq - basefreq 
    response = requests.patch(api_url, headers=headers, json=json.loads('{"SSBModSettings": {"inputFrequencyOffset": %d},"channelType": "SSBMod"}' % deltafreq))
  # f - report frequency
  if ( data.decode('UTF-8')[0] == 'f' ):
    conn.send( bytes( (str(freq)+'\n').encode('UTF-8') ) )
    print('f: '+str(freq))

Join to automatically receive all group messages.