Re: Doppler shift correction

cswiger@...
 
Edited

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 -  https://www.youtube.com/watch?v=LIqqZrmwT1M  (video actually shows it backwards - corrected below, gpredict has +value and sdrangel -value)

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

# XW-2A  uhf uplink linear transponder middle 
basefreq = 435040000
deltafreq = 0 
api_url_base = 'http://127.0.0.1:8091/'
headers = {'Content-Type': 'application/json'}
api_url = '{0}sdrangel/deviceset/1/channel/0/settings'.format(api_url_base)
 
sock = socket.socket()
sock.bind(('127.0.0.1',4532))
sock.listen(1)
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 sdrangel@groups.io to automatically receive all group messages.