From 2ca9c0e02aab6bb8750e86985d4eb61cec1fbc7a Mon Sep 17 00:00:00 2001 From: elijahab Date: Thu, 9 Jul 2026 05:45:27 -0700 Subject: [PATCH 1/3] All filter wheel config files. Daemon tested through FEI machine but the filter wheels where not tested with daemons as they are on Palomar. Config based off of HISPEC Plug Assignments. Baseline config. -Elijah.AB --- config/hscal/hscal_blue_fw1.yaml | 32 ++++++++++++++++++++++++++++++++ config/hscal/hscal_blue_fw2.yaml | 32 ++++++++++++++++++++++++++++++++ config/hscal/hscal_grey_fw.yaml | 32 ++++++++++++++++++++++++++++++++ config/hscal/hscal_red_fw1.yaml | 32 ++++++++++++++++++++++++++++++++ config/hscal/hscal_red_fw2.yaml | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 config/hscal/hscal_blue_fw1.yaml create mode 100644 config/hscal/hscal_blue_fw2.yaml create mode 100644 config/hscal/hscal_grey_fw.yaml create mode 100644 config/hscal/hscal_red_fw1.yaml create mode 100644 config/hscal/hscal_red_fw2.yaml diff --git a/config/hscal/hscal_blue_fw1.yaml b/config/hscal/hscal_blue_fw1.yaml new file mode 100644 index 0000000..9f56562 --- /dev/null +++ b/config/hscal/hscal_blue_fw1.yaml @@ -0,0 +1,32 @@ +# HISPEC CAL BLUE FilterWheel1 — Thor labs fw 102c contoller instance +# +# Usage: +# daemons/generic/filterwheel -c config/hscal/hscal_blue_fw1.yaml + +peer_id: hscal_blue_fw1 +group_id: hscal + +hardware: + ip_address: 192.168.29.153 + tcp_port: 10001 + units: filter_pos + timeout_s: 30.0 + retry_count: 3 + +limits: + soft_min: 1 + soft_max: 6 + hard_min: 1 + hard_max: 6 + +named_positions: + empty: 1 + OD1: 2 + OD2: 3 + OD4: 4 + OD5: 5 + empty2: 6 + +logging: + level: INFO + file: /tmp/hscal_blue_fw1.log diff --git a/config/hscal/hscal_blue_fw2.yaml b/config/hscal/hscal_blue_fw2.yaml new file mode 100644 index 0000000..df89b16 --- /dev/null +++ b/config/hscal/hscal_blue_fw2.yaml @@ -0,0 +1,32 @@ +# HISPEC CAL BLUE FilterWheel2 — Thor labs fw 102c contoller instance +# +# Usage: +# daemons/generic/filterwheel -c config/hscal/hscal_blue_fw2.yaml + +peer_id: hscal_blue_fw2 +group_id: hscal + +hardware: + ip_address: 192.168.29.153 + tcp_port: 10002 + units: filter_pos + timeout_s: 30.0 + retry_count: 3 + +limits: + soft_min: 1 + soft_max: 6 + hard_min: 1 + hard_max: 6 + +named_positions: + empty: 1 + OD1: 2 + OD2: 3 + OD4: 4 + OD5: 5 + empty2: 6 + +logging: + level: INFO + file: /tmp/hscal_blue_fw2.log diff --git a/config/hscal/hscal_grey_fw.yaml b/config/hscal/hscal_grey_fw.yaml new file mode 100644 index 0000000..1918189 --- /dev/null +++ b/config/hscal/hscal_grey_fw.yaml @@ -0,0 +1,32 @@ +# HISPEC CAL GREY UNIT FilterWheel — Thor labs fw 102c contoller instance +# +# Usage: +# daemons/generic/filterwheel -c config/hscal/hscal_grey_fw.yaml + +peer_id: hscal_grey_fw +group_id: hscal + +hardware: + ip_address: 192.168.29.130 + tcp_port: 10004 + units: filter_pos + timeout_s: 30.0 + retry_count: 3 + +limits: + soft_min: 1 + soft_max: 6 + hard_min: 1 + hard_max: 6 + +named_positions: + empty: 1 + OD1: 2 + OD2: 3 + OD4: 4 + OD5: 5 + empty2: 6 + +logging: + level: INFO + file: /tmp/hscal_grey_fw.log diff --git a/config/hscal/hscal_red_fw1.yaml b/config/hscal/hscal_red_fw1.yaml new file mode 100644 index 0000000..58e3ec0 --- /dev/null +++ b/config/hscal/hscal_red_fw1.yaml @@ -0,0 +1,32 @@ +# HISPEC CAL RED FilterWheel1 — Thor labs fw 102c contoller instance +# +# Usage: +# daemons/generic/filterwheel -c config/hscal/hscal_red_fw1.yaml + +peer_id: hscal_red_fw1 +group_id: hscal + +hardware: + ip_address: 192.168.29.130 + tcp_port: 10002 + units: filter_pos + timeout_s: 30.0 + retry_count: 3 + +limits: + soft_min: 1 + soft_max: 6 + hard_min: 1 + hard_max: 6 + +named_positions: + empty: 1 + OD1: 2 + OD2: 3 + OD4: 4 + OD5: 5 + empty2: 6 + +logging: + level: INFO + file: /tmp/hscal_red_fw1.log diff --git a/config/hscal/hscal_red_fw2.yaml b/config/hscal/hscal_red_fw2.yaml new file mode 100644 index 0000000..fd25ecf --- /dev/null +++ b/config/hscal/hscal_red_fw2.yaml @@ -0,0 +1,32 @@ +# HISPEC CAL RED FilterWheel2 — Thor labs fw 102c contoller instance +# +# Usage: +# daemons/generic/filterwheel -c config/hscal/hscal_red_fw2.yaml + +peer_id: hscal_red_fw2 +group_id: hscal + +hardware: + ip_address: 192.168.29.130 + tcp_port: 10003 + units: filter_pos + timeout_s: 30.0 + retry_count: 3 + +limits: + soft_min: 1 + soft_max: 6 + hard_min: 1 + hard_max: 6 + +named_positions: + empty: 1 + OD1: 2 + OD2: 3 + OD4: 4 + OD5: 5 + empty2: 6 + +logging: + level: INFO + file: /tmp/hscal_red_fw2.log From 6a4159588fb47ef87ff9f0066ce9adb7dbea45fd Mon Sep 17 00:00:00 2001 From: elijahab Date: Thu, 9 Jul 2026 05:53:52 -0700 Subject: [PATCH 2/3] Change names of files and daemons to match jira --- .../hscal/{hscal_red_fw1.yaml => hscal_hkcalfwheel1.yaml} | 6 +++--- .../hscal/{hscal_red_fw2.yaml => hscal_hkcalfwheel2.yaml} | 6 +++--- .../hscal/{hscal_grey_fw.yaml => hscal_hkgcellfwheel.yaml} | 6 +++--- .../hscal/{hscal_blue_fw1.yaml => hscal_yjcalfwheel1.yaml} | 6 +++--- .../hscal/{hscal_blue_fw2.yaml => hscal_yjcalfwheel2.yaml} | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) rename config/hscal/{hscal_red_fw1.yaml => hscal_hkcalfwheel1.yaml} (73%) rename config/hscal/{hscal_red_fw2.yaml => hscal_hkcalfwheel2.yaml} (73%) rename config/hscal/{hscal_grey_fw.yaml => hscal_hkgcellfwheel.yaml} (73%) rename config/hscal/{hscal_blue_fw1.yaml => hscal_yjcalfwheel1.yaml} (73%) rename config/hscal/{hscal_blue_fw2.yaml => hscal_yjcalfwheel2.yaml} (73%) diff --git a/config/hscal/hscal_red_fw1.yaml b/config/hscal/hscal_hkcalfwheel1.yaml similarity index 73% rename from config/hscal/hscal_red_fw1.yaml rename to config/hscal/hscal_hkcalfwheel1.yaml index 58e3ec0..6fbac3c 100644 --- a/config/hscal/hscal_red_fw1.yaml +++ b/config/hscal/hscal_hkcalfwheel1.yaml @@ -1,9 +1,9 @@ # HISPEC CAL RED FilterWheel1 — Thor labs fw 102c contoller instance # # Usage: -# daemons/generic/filterwheel -c config/hscal/hscal_red_fw1.yaml +# daemons/generic/filterwheel -c config/hscal/hscal_hkcalfwheel1.yaml -peer_id: hscal_red_fw1 +peer_id: hscal_hkcalfwheel1 group_id: hscal hardware: @@ -29,4 +29,4 @@ named_positions: logging: level: INFO - file: /tmp/hscal_red_fw1.log + file: /tmp/hscal_hkcalfwheel1.log diff --git a/config/hscal/hscal_red_fw2.yaml b/config/hscal/hscal_hkcalfwheel2.yaml similarity index 73% rename from config/hscal/hscal_red_fw2.yaml rename to config/hscal/hscal_hkcalfwheel2.yaml index fd25ecf..e23a882 100644 --- a/config/hscal/hscal_red_fw2.yaml +++ b/config/hscal/hscal_hkcalfwheel2.yaml @@ -1,9 +1,9 @@ # HISPEC CAL RED FilterWheel2 — Thor labs fw 102c contoller instance # # Usage: -# daemons/generic/filterwheel -c config/hscal/hscal_red_fw2.yaml +# daemons/generic/filterwheel -c config/hscal/hscal_hkcalfwheel2.yaml -peer_id: hscal_red_fw2 +peer_id: hscal_hkcalfwheel2 group_id: hscal hardware: @@ -29,4 +29,4 @@ named_positions: logging: level: INFO - file: /tmp/hscal_red_fw2.log + file: /tmp/hscal_hkcalfwheel2.log diff --git a/config/hscal/hscal_grey_fw.yaml b/config/hscal/hscal_hkgcellfwheel.yaml similarity index 73% rename from config/hscal/hscal_grey_fw.yaml rename to config/hscal/hscal_hkgcellfwheel.yaml index 1918189..6868ad2 100644 --- a/config/hscal/hscal_grey_fw.yaml +++ b/config/hscal/hscal_hkgcellfwheel.yaml @@ -1,9 +1,9 @@ # HISPEC CAL GREY UNIT FilterWheel — Thor labs fw 102c contoller instance # # Usage: -# daemons/generic/filterwheel -c config/hscal/hscal_grey_fw.yaml +# daemons/generic/filterwheel -c config/hscal/hscal_hkgcellfwheel.yaml -peer_id: hscal_grey_fw +peer_id: hscal_hkgcellfwheel group_id: hscal hardware: @@ -29,4 +29,4 @@ named_positions: logging: level: INFO - file: /tmp/hscal_grey_fw.log + file: /tmp/hscal_hkgcellfwheel.log diff --git a/config/hscal/hscal_blue_fw1.yaml b/config/hscal/hscal_yjcalfwheel1.yaml similarity index 73% rename from config/hscal/hscal_blue_fw1.yaml rename to config/hscal/hscal_yjcalfwheel1.yaml index 9f56562..1b2c2f9 100644 --- a/config/hscal/hscal_blue_fw1.yaml +++ b/config/hscal/hscal_yjcalfwheel1.yaml @@ -1,9 +1,9 @@ # HISPEC CAL BLUE FilterWheel1 — Thor labs fw 102c contoller instance # # Usage: -# daemons/generic/filterwheel -c config/hscal/hscal_blue_fw1.yaml +# daemons/generic/filterwheel -c config/hscal/hscal_yjcalfwheel1.yaml -peer_id: hscal_blue_fw1 +peer_id: hscal_yjcalfwheel1 group_id: hscal hardware: @@ -29,4 +29,4 @@ named_positions: logging: level: INFO - file: /tmp/hscal_blue_fw1.log + file: /tmp/hscal_yjcalfwheel1.log diff --git a/config/hscal/hscal_blue_fw2.yaml b/config/hscal/hscal_yjcalfwheel2.yaml similarity index 73% rename from config/hscal/hscal_blue_fw2.yaml rename to config/hscal/hscal_yjcalfwheel2.yaml index df89b16..1eb86bb 100644 --- a/config/hscal/hscal_blue_fw2.yaml +++ b/config/hscal/hscal_yjcalfwheel2.yaml @@ -1,9 +1,9 @@ # HISPEC CAL BLUE FilterWheel2 — Thor labs fw 102c contoller instance # # Usage: -# daemons/generic/filterwheel -c config/hscal/hscal_blue_fw2.yaml +# daemons/generic/filterwheel -c config/hscal/hscal_yjcalfwheel2.yaml -peer_id: hscal_blue_fw2 +peer_id: hscal_yjcalfwheel2 group_id: hscal hardware: @@ -29,4 +29,4 @@ named_positions: logging: level: INFO - file: /tmp/hscal_blue_fw2.log + file: /tmp/hscal_yjcalfwheel2.log From b9e1310d13821ca2c68a6c885b55d2f4b4ffe16f Mon Sep 17 00:00:00 2001 From: elijahab Date: Mon, 3 Aug 2026 13:12:47 -0700 Subject: [PATCH 3/3] Added ability to control stage in open loop via voltages --- daemons/hsfei/piaa-gimbalmount | 66 +++++++++++++++++++++++++++++----- 1 file changed, 57 insertions(+), 9 deletions(-) diff --git a/daemons/hsfei/piaa-gimbalmount b/daemons/hsfei/piaa-gimbalmount index 32fbb16..2cbf44a 100755 --- a/daemons/hsfei/piaa-gimbalmount +++ b/daemons/hsfei/piaa-gimbalmount @@ -18,10 +18,8 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 topics = {} #voltage control parameters - V_MIN = -20 + V_MIN = -25 V_MAX = 150 - DIGITAL_MIN = -32767 - DIGITAL_MAX = 32767 def __init__(self): """Initialize the Gimbal daemon.""" @@ -97,18 +95,30 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 setter=self.keyword_wrapper(self.set_xpos, key="position"), validator=self._check_soft_limits, units=self.units, - description="Set and get current position of GimbalMount.") + description="set/get current position of GimbalMount.") self.keyword_registry.float("positionvaluey", getter=self.keyword_wrapper(self.get_ypos, key="position"), setter=self.keyword_wrapper(self.set_ypos, key="position"), validator=self._check_soft_limits, units=self.units, - description="Set and get current position of GimbalMount.") + description="set/get current position of GimbalMount.") self.keyword_registry.string("positionnamed", getter=self.keyword_wrapper(self.cur_named_position, key="named_pos"), setter=self.keyword_wrapper(self.goto_named_pos, key="named_pos"), validator=self._check_named, - description="Set and get named position of GimbalMount.") + description="set/get named position of GimbalMount.") + self.keyword_registry.float("voltagevaluex", + getter=self.keyword_wrapper(self.get_xvolts, key="voltage"), + setter=self.keyword_wrapper(self.set_xvolts, key="voltage"), + validator=self._check_soft_limits, + units="Volts", + description="set/get voltage for open loop control of GimbalMount.") + self.keyword_registry.float("voltagevaluey", + getter=self.keyword_wrapper(self.get_yvolts, key="voltage"), + setter=self.keyword_wrapper(self.set_yvolts, key="voltage"), + validator=self._check_soft_limits, + units="Volts", + description="set/get voltage for open loop control of GimbalMount.") self.keyword_registry.int("softmin", getter=lambda: self._soft_min, setter=lambda v: setattr(self, "_soft_min", int(v)), @@ -268,6 +278,14 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 '''gets current Y position''' return self.get_pos(axis=1) + def get_xvolts(self): + '''gets current X voltage''' + return self.get_volts(axis=0) + + def get_yvolts(self): + '''gets current Y voltage''' + return self.get_volts(axis=1) + def get_pos(self, axis : int): '''gets current position''' if not self.dev.is_connected(): @@ -285,6 +303,27 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 return {"ok": False, "error": str(e)} return {"ok":True, "position": position} + def get_volts(self, axis): + '''gets output voltage for open loop control''' + if not self.dev.is_connected(): + return {"ok": False, "error": "Not connected to hardware"} + if not self.state['enabled']: + return {"ok": False, "error": "Device not enabled"} + if self.state['isloopsclosed']: + return {"ok": False, "error": "Control loops are closed; cannot get volts"} + try: + axis = int(axis) + if axis not in [0,1]: + self.logger.error("Axis must be 0 (X) or 1 (Y)") + return {"ok": False, "error": "Axis must be 0 (X) or 1 (Y)"} + chan = axis + 1 + voltage = self.dev.get_output_volts(channel=chan) + self.logger.debug("get_volts: %s",voltage) + except Exception as e: # pylint: disable=W0718 + self.logger.error("error: %s",e) + return {"ok": False, "error": str(e)} + return {"ok":True, "voltage": voltage} + def set_xpos(self, pos: float): '''sets current X position''' if self.state['isloopsclosed']: @@ -297,6 +336,14 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 return self.set_pos(axis=1, pos=pos) return self.set_volts(axis=1, volts=pos) + def set_xvolts(self, volts: float): + '''sets output voltage for open loop control''' + return self.set_volts(axis=0, volts=volts) + + def set_yvolts(self, volts: float): + '''sets output voltage for open loop control''' + return self.set_volts(axis=1, volts=volts) + def set_volts(self, axis: int, volts: float): '''sets output voltage for open loop control''' if not self.dev.is_connected(): @@ -311,11 +358,12 @@ class PiaaGimbalmount(HispecDaemon): #pylint: disable = W0223 if axis not in [0,1]: self.logger.error("Axis must be 0 (X) or 1 (Y)") return {"ok": False, "error": "Axis must be 0 (X) or 1 (Y)"} + if not self.V_MIN <= volts <= self.V_MAX: + self.logger.error("Voltage must be between %s and %s", self.V_MIN, self.V_MAX) + return {"ok": False, "error": f"Voltage must be between {self.V_MIN} and {self.V_MAX}"} chan = axis + 1 #convert volts to int between -32768 and 32,767 for PPC102 - voltage_ratio = (volts - self.V_MIN) / (self.V_MAX - self.V_MIN) - volts_int = int(voltage_ratio*(self.DIGITAL_MAX-self.DIGITAL_MIN)+self.DIGITAL_MIN) - self.dev.set_output_volts(channel=chan, volts=volts_int) + self.dev.set_output_volts(channel=chan, volts=volts) self.logger.debug("set_volts: %s",volts) voltage = self.dev.get_status_update(channel=chan)[0] except Exception as e: # pylint: disable=W0718