Source code for device_client.client_magnets_motors

from device_client import DeviceClient
from device.magnets_motors import MagnetsMotors


description = """
Start by running the **Homing** command, but make sure
to fully retract the probe 1 (left side) first! Use **Stop** anytime,
including during homing, to quickly terminate any motion. However, the
motors will then show incorrect position, re-run **Homing** to fix that.

*Make sure to fully rectract probe 1 (left side) before homing!*

#### Wire to
Moves the wire to a new position, beware of collisions with the probes.

- *position* = absolute position in mm, current position can be seen in the
  values section.

#### Probe to
Moves the motorized probe to a new position, beware of a collision with
the wire.

- *position* = absolute position in mm, current position can be seen in the
  values section.
"""

[docs] def connect(name, password, server, serial_probe, serial_wire): client = DeviceClient(name, password, title="Magnetic field: Motors", description=description) hw = MagnetsMotors( "./configurations/calib_magnets.cfg", buses=[serial_probe, serial_wire], 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.homing, "Homing") client.register_command(hw.wire_moveto, "Wire to", inputs=[{"unit": "mm"}]) client.register_command(hw.probe_moveto, "Probe to", inputs=[{"unit": "mm"}]) client.register_background_task(hw.update_frontend) client.keep_server_updated( check_readiness=hw.is_ready, check_readiness_interval=0.5, server_address=server, retry_on_error=True )