feat(smargon): drivable O-vector motors sgox/sgoy/sgoz
Add SmargopoloMotor entries for OX/OY/OZ to the beamline and sim configs (baseline readout, no default soft limits), document them, and test single-axis moves, limits, the READY gate and move_scs with O axes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aca50ee310
commit
6b0fe76d4d
5 files changed
+121
-5
No files matched your search
@@ -6,7 +6,7 @@
|
||||
# host/port so they share the controller.
|
||||
#
|
||||
# The motor NAME (the top-level key: sgx, sgchi, ...) is yours to choose. The
|
||||
# `scs_axis` field binds it to the fixed smargopolo axis (SHX/SHY/SHZ/CHI/PHI/OMEGA).
|
||||
# `scs_axis` field binds it to the fixed smargopolo axis (SHX/SHY/SHZ/CHI/PHI/OMEGA/OX/OY/OZ).
|
||||
#
|
||||
# Referencing is a deliberate operator action: after loading, run once
|
||||
# dev.smargon.reference() # (or dev.sgx.controller.reference())
|
||||
@@ -75,6 +75,36 @@ sgphi:
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
# --- O-vector (SCS offset vector OX/OY/OZ, mm) ------------------------------------
|
||||
# Drivable like any SCS axis and recorded in the baseline. No soft limits by default
|
||||
# (smargopolo enforces the real ones) -- add `limits: [low, high]` per experiment.
|
||||
sgox:
|
||||
description: SmarGon OX (offset vector)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OX, host: tt-smargopolo, port: 3000, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
sgoy:
|
||||
description: SmarGon OY (offset vector)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OY, host: tt-smargopolo, port: 3000, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
sgoz:
|
||||
description: SmarGon OZ (offset vector)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OZ, host: tt-smargopolo, port: 3000, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
# --- Optional OMEGA rotation drive (only on builds that have it) -------------------
|
||||
# sgomega:
|
||||
# description: SmarGon OMEGA (rotation drive)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Self-contained laptop test session for the SmarGon device (SIMULATION).
|
||||
#
|
||||
# Per-axis motors (dev.sgx, dev.sgy, dev.sgz, dev.sgchi, dev.sgphi, dev.sgomega) +
|
||||
# Per-axis motors (dev.sgx, dev.sgy, dev.sgz, dev.sgchi, dev.sgphi, dev.sgox/sgoy/sgoz,
|
||||
# optional dev.sgomega) +
|
||||
# a `smargon` coordinator, all sharing one simulated controller, plus a sim monitor
|
||||
# so scans record data. No smargopolo server / hardware needed.
|
||||
#
|
||||
@@ -102,6 +103,36 @@ sgphi:
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
# --- O-vector (SCS offset vector OX/OY/OZ, mm) ------------------------------------
|
||||
# Drivable like any SCS axis and recorded in the baseline. No soft limits by default
|
||||
# (smargopolo enforces the real ones) -- add `limits: [low, high]` per experiment.
|
||||
sgox:
|
||||
description: SmarGon OX (offset vector, sim)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OX, simulation: true, gradual_motion: true, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon, simulation]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
sgoy:
|
||||
description: SmarGon OY (offset vector, sim)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OY, simulation: true, gradual_motion: true, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon, simulation]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
sgoz:
|
||||
description: SmarGon OZ (offset vector, sim)
|
||||
deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
deviceConfig: {scs_axis: OZ, simulation: true, gradual_motion: true, tolerance: 0.001}
|
||||
deviceTags: [goniometer, smargon, simulation]
|
||||
enabled: true
|
||||
onFailure: retry
|
||||
readoutPriority: baseline
|
||||
|
||||
# sgomega:
|
||||
# description: SmarGon OMEGA (sim)
|
||||
# deviceClass: csaxs_bec.devices.smargon.positioner.SmargopoloMotor
|
||||
|
||||
@@ -34,8 +34,13 @@ poll-to-tolerance moves), since both wrap a non-EPICS, poll-to-confirm HTTP back
|
||||
|
||||
- **One motor per axis**, top-level: the YAML key is the BEC name (**you choose it**:
|
||||
`sgx`, `sgchi`, …); a `scs_axis:` field binds it to the fixed smargopolo axis name
|
||||
(`SHX/SHY/SHZ/CHI/PHI/OMEGA`). OMEGA is optional hardware — add a motor entry only on
|
||||
builds that have it.
|
||||
(`SHX/SHY/SHZ/CHI/PHI/OMEGA/OX/OY/OZ`). OMEGA is optional hardware — add a motor entry
|
||||
only on builds that have it.
|
||||
- **O-vector motors** `sgox/sgoy/sgoz` drive the SCS offset vector `OX/OY/OZ` (all mm).
|
||||
They are ordinary motors (`umv`, scans, baseline readout), so the offset is recorded
|
||||
with every scan. They have no soft limits by default; set `limits` per experiment.
|
||||
`nudge_beamline(modify_offset=True)` (`/nudgeOBCS`) also changes them; their readback
|
||||
catches up on the next read.
|
||||
- **`dev.smargon`** — the coordinator: `reference()`, `get_mode()`, `is_ready()`,
|
||||
`wait_until_ready()`, `move_scs(...)`, `nudge_beamline(...)`, `motor_positions()`,
|
||||
`stop_all()`, `transport_info()`, plus read-only `mode`/`rosout` signals.
|
||||
@@ -110,4 +115,7 @@ All run against `FakeTransport` — no hardware or server needed.
|
||||
`rosout` carries the reason), so the abort path is dependable.
|
||||
- **PHI wrap**: the MX-lab reference client wraps PHI to `[-180,180)` before sending.
|
||||
Confirm whether smargopolo wraps server-side, or whether the motor should.
|
||||
- **O-vector semantics**: confirm what `OX/OY/OZ` represent physically, whether
|
||||
changing them moves the sample (or only re-expresses `SH*`), sensible travel ranges,
|
||||
and that `OZ` is in mm (the API example shows `OZ: 300.0`, the example client 180).
|
||||
- *(resolved)* OMEGA is drivable via `/targetSCS` wherever it physically exists.
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Per-axis SmarGon motor -- a top-level BEC device for one SCS axis.
|
||||
|
||||
``SmargopoloMotor`` is an independent ophyd positioner (``Device`` +
|
||||
``PositionerBase``): each SCS axis (SHX/SHY/SHZ/CHI/PHI/OMEGA) is its own top-level
|
||||
``PositionerBase``): each SCS axis (SHX/SHY/SHZ/CHI/PHI/OMEGA/OX/OY/OZ) is its own top-level
|
||||
BEC motor, exactly like the ``smaract`` motors. It talks to hardware only through a
|
||||
shared :class:`~csaxs_bec.devices.smargon.controller.SmargopoloController` (singleton
|
||||
per smargopolo server), so ``dev.sgx`` and ``dev.sgchi`` pointing at the same host
|
||||
|
||||
@@ -196,3 +196,50 @@ def test_move_scs_aborts_on_controller_fault():
|
||||
coord.controller.transport._mode = Mode.ERROR
|
||||
with pytest.raises(SmargopoloModeError):
|
||||
coord.move_scs(SHX=1e6, wait=True)
|
||||
|
||||
|
||||
# -- O-vector (OX/OY/OZ) motors ----------------------------------------------
|
||||
|
||||
|
||||
@pytest.mark.parametrize("axis", ["OX", "OY", "OZ"])
|
||||
def test_o_vector_axes_are_mm_motors(axis):
|
||||
m = _motor(f"sgo{axis[1].lower()}", axis)
|
||||
assert m.egu == "mm"
|
||||
assert m.limits == (0.0, 0.0) # unbounded unless configured
|
||||
|
||||
|
||||
def test_o_vector_initial_readback_and_record():
|
||||
sgoz = _motor("sgoz", "OZ")
|
||||
assert sgoz.position == pytest.approx(180.0) # fake's home O-vector
|
||||
assert sgoz.read()["sgoz"]["value"] == pytest.approx(180.0)
|
||||
|
||||
|
||||
def test_o_vector_move_and_limits():
|
||||
coord = _coordinator()
|
||||
sgox = _motor("sgox", "OX", limits=[-1, 1])
|
||||
sgoz = _motor("sgoz", "OZ")
|
||||
coord.reference()
|
||||
sgox.move(0.25, wait=True)
|
||||
sgoz.move(200.0, wait=True)
|
||||
assert sgox.position == pytest.approx(0.25)
|
||||
assert sgoz.position == pytest.approx(200.0)
|
||||
with pytest.raises(LimitError):
|
||||
sgox.move(5.0)
|
||||
|
||||
|
||||
def test_o_vector_move_refused_until_referenced():
|
||||
sgoy = _motor("sgoy", "OY")
|
||||
with pytest.raises(SmargopoloModeError):
|
||||
sgoy.move(0.1)
|
||||
|
||||
|
||||
def test_move_scs_includes_o_vector():
|
||||
coord = _coordinator()
|
||||
sgx = _motor("sgx", "SHX")
|
||||
sgoy = _motor("sgoy", "OY", limits=[-1, 1])
|
||||
coord.reference()
|
||||
coord.move_scs(SHX=0.1, OY=-0.4, wait=True)
|
||||
assert sgx.position == pytest.approx(0.1)
|
||||
assert sgoy.position == pytest.approx(-0.4)
|
||||
with pytest.raises(LimitError):
|
||||
coord.move_scs(OY=3.0)
|
||||
Reference in new issue
Block a user