Gpredict Python Rotator Control

What is the format of the message going back to gpredict “READ”

I am getting “P xxx.xx xx.xx” on the data = connection.recv(24).
however, I am not successful in sending the stepping motor data back out to the READ so it can display in Gpredict Rotator Control

See under protocol:
http://manpages.ubuntu.com/manpages/xenial/man8/rotctld.8.html

I have a simple python test script that receives the Rotator Az and EL with no problem

All I am doing for testing is getting the data from GPredict and sending right back to Gpredict with lower case “p”

I get Read: 0.00 on both Az and EL

I am not using the hamlib libary at all

in the log file I am seeing

2018/04/23 22:03:08|2|2|gtk-rot-ctrl.c:1189: rotctld returned error 40 with az 340.107770 el 0.000000(p 340.11 0.00)
2018/04/23 22:03:09|2|2|gtk-rot-ctrl.c:1189: rotctld returned error 40 with az 340.107770 el 0.000000(p 340.11 0.00)
2018/04/23 22:03:10|2|2|gtk-rot-ctrl.c:1189: rotctld returned error 40 with az 340.107770 el 0.000000(p 340.11 0.00)
2018/04/23 22:03:11|2|2|gtk-rot-ctrl.c:1189: rotctld returned error 40 with az 340.107770 el 0.000000(p 340.11 0.00)
2018/04/23 22:03:12|2|2|gtk-rot-ctrl.c:1189: rotctld returned error 40 with az 340.107770 el 0.000000(p 340.11 0.00)

#!/usr/bin/env python

import socket
import sys

HOST = None # Symbolic name meaning all available interfaces
PORT = 4533 # Arbitrary non-privileged port
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,
socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except socket.error as msg:
s = None
continue
try:
s.bind(sa)
s.listen(1)
except socket.error as msg:
s.close()
s = None
continue
break
if s is None:
print ‘could not open socket’
sys.exit(1)
conn, addr = s.accept()
print ‘Connected by’, addr
while 1:
data = conn.recv(1024)
print ‘received: %s’ % data
outdata = string.lower(’%s’ % data)
print(“output;” + outdata)
conn.send(outdata)
if not data: break
conn.close()

It doesn’t matter whether you use hamlib or not. If you want gpredict to talk to your server your server has to implement the rotctld protocol. This includes acknowledging the commands using the RPRT reply. Please see the protocol description I have linked to above.

I managed to get the radio control working in a python script but I lost that script awhile ago. (I went digging thru the GPredict code base to do that one)

I installed the hamlib and then used the rotctrld to bridge the connection between my application and Gpredict.
I just run
echo “+\get_pos” | nc -w 1 localhost 4533
to get the position
and
echo “+\set_pos 180 0” | nc -w 1 localhost 4533
in my code to set the position. It is clugy but it works. I did modify the Dummy code in hamlib to allow for 360 -> 0 rotation.

When I get my stepping motors and controller in I will do a complete video kn4kuu.com