Source code for device_client.client_interfer_motors
from device_client import DeviceClient
from device.interfer_motors import InterferometryMotors
description = """
Start by running the **Homing** command. Use **Stop** anytime, including during
homing, to quickly terminate any motion. The position tracking, as seen in
values section, is reliable even after using the **Stop** command.
#### Antenna to
Moves antenna to a new position, try to prevent collision with object.
- *position* = absolute position in mm, current position can be seen in the
values section.
#### Object to
Moves object (e.g. glass) to a new position, try to prevent collision with antenna.
- *position* = absolute position in mm, current position can be seen in the
values section.
#### Oscope ON + OFF
Switch on or off the oscilloscope. When switched on, it should appear as a new
device in this experiment.
#### Board ON + OFF
Switch on or off the interferometry board. Check the oscilloscope signal to see
if it works.
"""
[docs]
def connect(name, password, server):
client = DeviceClient(name, password,
title="Interferometry: Motors", description=description)
hw = InterferometryMotors(
"./configurations/calib_interfer.cfg",
buses=None, # Autoscan for /dev/ttyUSB*
limits_enabled=False, # Do not use software limits from .cfg file
log_callback=client.emit_log,
)
client.register_command(hw.stop, "Stop")
client.register_command(hw.relay1_on, "Oscope ON")
client.register_command(hw.relay2_on, "Board ON")
client.register_command(hw.relay1_off, "Oscope OFF")
client.register_command(hw.relay2_off, "Board OFF")
client.register_command(hw.homing, "Homing")
client.register_command(hw.anetenna_moveto, "Antenna to", inputs=[{"unit": "mm"}])
client.register_command(hw.object_moveto, "Object to", inputs=[{"unit": "mm"}])
client.register_background_task(hw.update_frontend)
client.keep_server_updated(
check_readiness=hw.is_ready,
check_readiness_interval=1,
server_address=server,
retry_on_error=True
)