diff --git a/socs/agents/wiregrid_tiltsensor/agent.py b/socs/agents/wiregrid_tiltsensor/agent.py index a62517cc6..56da940b6 100644 --- a/socs/agents/wiregrid_tiltsensor/agent.py +++ b/socs/agents/wiregrid_tiltsensor/agent.py @@ -1,10 +1,11 @@ import time from ocs import ocs_agent, site_config -from ocs.ocs_twisted import TimeoutLock, Pacemaker +from ocs.ocs_twisted import Pacemaker, TimeoutLock from socs.agents.wiregrid_tiltsensor.drivers import connect + class WiregridTiltSensorAgent: """ Agent to record the wiregrid tilt sensor data. The tilt sensor data is sent via serial-to-ethernet converter. diff --git a/socs/agents/wiregrid_tiltsensor/drivers/dwl.py b/socs/agents/wiregrid_tiltsensor/drivers/dwl.py index 8b1036015..81aa81d20 100755 --- a/socs/agents/wiregrid_tiltsensor/drivers/dwl.py +++ b/socs/agents/wiregrid_tiltsensor/drivers/dwl.py @@ -41,10 +41,10 @@ def get_angle(self): command = b"\x06\x01\x02\xAA\x00\x00\x00\x00\x00\x00\x00\x00" if self.verbose > 0: print(f'get_angle() command = {command}') - + read = [] SIZE = 12 - + # write and read serial self.ser.write(command) read_hex = self.ser.read(SIZE) @@ -54,7 +54,7 @@ def get_angle(self): if self.verbose > 0: print(f'read_hex = {read_hex}') print(f'read = {read}') - + # check header matching and calculate the angles if self.isSingle: header = ['0x61', '0x11'] diff --git a/socs/agents/wiregrid_tiltsensor/drivers/sherborne.py b/socs/agents/wiregrid_tiltsensor/drivers/sherborne.py index e479b7341..8095b490e 100755 --- a/socs/agents/wiregrid_tiltsensor/drivers/sherborne.py +++ b/socs/agents/wiregrid_tiltsensor/drivers/sherborne.py @@ -28,7 +28,7 @@ def __init__(self, tcp_ip=None, tcp_port=None, timeout=None, reset_boot=False, v self.tcp_ip = tcp_ip self.tcp_port = tcp_port self.verbose = verbose - + # Connect to device msg = self.__conn(tcp_ip, tcp_port, timeout) print(msg) @@ -58,14 +58,14 @@ def get_angle(self): value_read_angleY = value_read_angleY.replace('\r', '') if self.verbose > 0: print(f'read_angleY = {value_read_angleY}') - + self.wait() val = (value_read_angleX, value_read_angleY) msg = f"Measured angle: X = {value_read_angleX}, Y = {value_read_angleY}" if self.verbose > 0: print(msg) - + return msg, val def __conn(self, tcp_ip, tcp_port, timeout):