# Linking Gnuradio and Gpredict?

**URL:** <https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818>\
**Category:** GNU Radio\
**Created:** [July 22, 2013, 1:33pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818 "2013-07-22T13:33:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [July 22, 2013, 1:33pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/1 "2013-07-22T13:33:00Z")

</div>

Is it possible to link Gnuradio and Gpredict ? I want to use Gpredict as  
tracker controlling the antenna position and to pass doppler corrected  
frequency data to Gnuradio.  
Does any interface to Gpredict (or hamlib) exist ?  
thanks for any hints, Mark

---

<div class="post-metadata">

**Author:** ![M\_Dammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@M\_Dammer](https://www.ruby-forum.com/u/M_Dammer)\
**Post date:** [July 22, 2013, 1:40pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/2 "2013-07-22T13:40:01Z")

</div>

Hi,

Gpredict is based on predict, which has several interfaces for Doppler  
prediction. Not sure if Gpredict inherited these interfaces.

Yours  
Martin

Am 22.07.2013 13:31, schrieb M Dammer:

---

<div class="post-metadata">

**Author:** ![M\_Dammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@M\_Dammer](https://www.ruby-forum.com/u/M_Dammer)\
**Post date:** [March 28, 2014, 3:48pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/3 "2014-03-28T15:48:49Z")

</div>

Hi,  
Can you explain in detail regarding querying the Gpredict for doppler  
corrected freq. using UDP, since I novice to UDP. If possible, can you  
please post the relevant code.

Rajesh

–  
View this message in context:  
[http://gnuradio.4.n7.nabble.com/linking-Gnuradio-and-Gpredict-tp42620p47286.html](http://gnuradio.4.n7.nabble.com/linking-Gnuradio-and-Gpredict-tp42620p47286.html)  
Sent from the GnuRadio mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![M\_Dammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@M\_Dammer](https://www.ruby-forum.com/u/M_Dammer)\
**Post date:** [July 22, 2013, 3:49pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/4 "2013-07-22T15:49:08Z")

</div>

On 22/07/13 12:31, M Dammer wrote:

> Is it possible to link Gnuradio and Gpredict ? I want to use Gpredict as  
> tracker controlling the antenna position and to pass doppler corrected  
> frequency data to Gnuradio.

In a word, yes.

Can be very simple. I did it by using an XML Server in the flow graph,  
and wrote a quick XML client (actually I “stole” most of it from an  
example), and sent the doppler info from predict via a variable.

doppler info was received from predict using some code to query predict  
using UDP. I think I just used nc to send the UDP query to predict,  
recovered the shift from the reply, and sent it back to the XML Server  
running within the flow graph.

Unfortunately I can’t find my actual code right now, but I literally  
copied an example, and added the UDP Predict clients bit. It went  
something like this pseudo code (Yes, this is a mix of shell,and  
python, and you need to re-write the getting doppler from predict  
yourself, but you get the idea, and should give you enough)

import time  
import sys  
from socket import \*  
import xmlrpclib  
import binascii

s = xmlrpclib.Server(“[http://192.168.39.74:8081](http://192.168.39.74:8081)”)  
infinite=1  
while infinite == 1;

# Grab predict doppler using UDP

DOPPLER=`nc -u -s 2 $PREDICTHOST GET_DOPPLER $NORAD_NUMBER`  
s.set\_doppler\_shift($DOPPLER)  
time.sleep(1)

The variable (lets call it doppler\_shift) exists in the flowgraph,  
and was multiplied appropriately and applied to the centre frequency of  
a FIR filter.

You can pretty much pass any information you want in and out of a flow  
graph using a XML Server/Client pair. I’ve done TX/RX switching, and  
am currently working on telemetry decoding/display

Iain

---

<div class="post-metadata">

**Author:** ![M\_Dammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@M\_Dammer](https://www.ruby-forum.com/u/M_Dammer)\
**Post date:** [March 28, 2014, 6:34pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/5 "2014-03-28T18:34:43Z")

</div>

I just found a good starting point. This program uses hamlib, a library  
that is often used to control rigs and antenna rotors and that is  
supported by GPredict:

> **[Hamlib and SDR](http://james.ahlstrom.name/hamlib.html)**
>
> Hamlib and Software Defined Radio

I just tested it and GPredict connects well to localhost:4575. The  
server programs output shows the proper doppler corrected frequencies  
etc. As it is python it can probably “converted” into a GRC block.

73 Mark

---

<div class="post-metadata">

**Author:** ![M\_Dammer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@M\_Dammer](https://www.ruby-forum.com/u/M_Dammer)\
**Post date:** [March 28, 2014, 7:36pm UTC](https://www.ruby-forum.com/t/linking-gnuradio-and-gpredict/245818/6 "2014-03-28T19:36:03Z")

</div>

If all you need is something in python you can just use pyephem  
[http://rhodesmill.org/pyephem/](http://rhodesmill.org/pyephem/)

Alex
