-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Dan Avner edited this page Nov 21, 2019
·
26 revisions
Welcome to the 90prime-galil-fwgui wiki!
Here you will find all documentation and examples done for the 90Prime fw-gui and galilserver.
Python 3
import socket
import sys
from struct import *
HOST = '10.30.1.2'
PORT = 9874
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOST, PORT))
# returns "OK: Connected to galilserver. Client 1"
message = sock.recv(1024).decode()
# request all LVDT values
# returns "OK: 0.600 0.727 0.507" in order of LVDT A, B, then C
sock.send('SHOWALLLVDTVALS\r\n'.encode())
message = sock.recv(1024).decode()
# request actuator encoder values
# requires sending a STATUS command
sock.send('STATUS\r\n'.encode())
message = sock.recv(1024)
sock.close()
# must remove the "OK: " of response
message_slice = message[4:len(message)]
# each actuator encoder value is at different byte locations
# actuator A = 52
# actuator B = 80
# actuator C = 108
# getting actuator A
raw_actuator_encoder_a = message_slice[52:54]
# must unpack the response
# 'h' is for signed short integer
# https://docs.python.org/3.8/library/struct.html
actuator_encoder_a = unpack('h', raw_actuator_encoder_a)[0] # returns tuple
Currently, only high level commmands to galil server are being documented.
Daily logs of progress and notes.