fix(omny): realistic sim motor temperatures, rotation heads-up, and corr_pos_x crash
CI for csaxs_bec / test (push) Successful in 1m47s

- sim_galil.py: default unseeded analog-input channels to a voltage that
  reads back as a realistic ~30 degC motor temperature instead of the
  previous 0.0V/150 degC default (real motors run well under 60 degC).
- rt_omny_ophyd.py: feedback_enable_with_reset() now tells the user the
  current angle and warns it might take a while when osamroy has more
  than 5 deg to rotate back to zero, matching flomni's style of heads-up.
- omny_sample_transfer_mixin.py: otransfer_put_sample() now calls
  reset_correction()/reset_tomo_alignment_fit() when mounting into the
  sample stage (pin_position == 0), mirroring flomni's
  ftransfer_put_sample() -> ftransfer_flomni_stage_in() pattern. Fixes
  an AttributeError ('OMNY' object has no attribute 'corr_pos_x') hit
  when calling tomo_scan_projection() after a sample transfer.
This commit is contained in:
x01dc committed 2026-09-01 14:17:38 +02:00
1 parent 57903579fc
commit 446b201302
3 files changed
+26 -5

No files matched your search

@@ -764,6 +764,14 @@ class OMNYSampleTransferMixin:
self._otransfer_controller_disable_mount_mode()
# update the new sample status in storage
self._otransfer_check_free_slot_available_at_position(pin_position, 1)
if pin_position == 0:
# sample is now in the sample stage (scanning position): any alignment
# correction data belongs to the previous sample, discard it -- matches
# flomni's ftransfer_put_sample()/ftransfer_flomni_stage_in()
self.reset_correction()
self.reset_tomo_alignment_fit()
# this also moves the gripper to parking position
# alternatively a next sample is to be picked
# keep shuttle open and ask user which sample to pick
+10 -3
View File
@@ -527,9 +527,16 @@ class RtOMNYController(Controller):
# the following read will also upate the angle in rt during readout
readback = osamroy.obj.readback.get()
if np.fabs(readback) > 0.1:
self.device_manager.connector.send_client_info(
f"Rotating to zero", scope="feedback enable", show_asap=True
)
if np.fabs(readback) > 5:
self.device_manager.connector.send_client_info(
f"Rotating from {readback:.1f} deg to zero. This might take a while.",
scope="feedback enable",
show_asap=True,
)
else:
self.device_manager.connector.send_client_info(
f"Rotating to zero", scope="feedback enable", show_asap=True
)
osamroy.obj.move(0, wait=True)
osamx = self.device_manager.devices.osamx
+8 -2
View File
@@ -40,6 +40,12 @@ _STPPERMM_EXPR_RE = re.compile(r"^([0-9.]+)\s*\*\s*stppermm\[(\d+)\]$")
_OMNY_ROTATION_PORT = 8083
_OMNY_ROTATION_AXIS = 2
# Default analog input voltage for unseeded channels, used by GalilController.
# motor_temperature() (@AN[axis+1], converted via (V+10)/20*300 to degC). -8.0V -> 30
# degC, a realistic idle motor temperature; the previous 0.0V default read back as
# 150 degC on every axis without an explicit sim_analog_inputs override.
_DEFAULT_ANALOG_INPUT_V = -8.0
class _SimGalilAxis:
"""State of a single simulated Galil axis (positions in microsteps)."""
@@ -144,7 +150,7 @@ class SimGalilState:
}
self.digital_inputs = {14: 1.0} # light curtain reads triggered by default
self.digital_outputs = {9: 0.0, 15: 1.0} # gripper closed, lights on
self.analog_inputs = {1: -1.6}
self.analog_inputs = {}
self._thread_deadlines = {} # thread_id -> unix time until which thread is active
self._transfer_thread = None
self._transfer_abort = threading.Event()
@@ -494,7 +500,7 @@ class SimGalilSocket(SimSocketBase):
return f"{state.digital_outputs.get(channel, 0.0):.4f}"
if arg.startswith("@AN["):
channel = int(arg[4:].split("]")[0])
return f"{state.analog_inputs.get(channel, 0.0):.4f}"
return f"{state.analog_inputs.get(channel, _DEFAULT_ANALOG_INPUT_V):.4f}"
if arg in ("allaxref", "axisref"):
return f"{1.0 if state.all_axes_referenced() else 0.0:.4f}"
if arg.startswith("axisref["):