Ushiba-san, YamaT-san, Ikeda
Overview
Ongoing trouble with HWP with encoder (K-Log#32783, #32475, etc.)
These have been noted to be out of alignment with the specified angles.
The control scripts for the HWP systems of PSL, IMC_REFL, and IFO_REFL have been updated.
With this update, the total(deg) value now reflects the encoder readings.
Details
Changes in Related EPICS Channels
total(deg): K1:SYS-HWP_{PSL,IMC_REFL,IFO_REFL}_STEP_TOTAL_DEG (Behavior changed)
step(deg): K1:SYS-HWP_{PSL,IMC_REFL,IFO_REFL}_STEP_DEG (No change)
base(deg): K1:SYS-HWP_{PSL,IMC_REFL,IFO_REFL}_CURRENT_DEG (Newly added)
→ Reference position upon controller initialization.
status: K1:SYS-HWP_{PSL,IMC_REFL,IFO_REFL}_STATUS (Newly added)
→ Motor operation status:
0: Stopped
1: Running
Change in Calculation Method of total(deg)
Before:
total(deg) was calculated by incrementing (or decrementing) step(deg) each time an operation was performed. This did not reflect the actual motor position.
After:
total(deg) is now calculated as:
total(deg) = Encoder reading + base(deg)
→ The actual motor position is now correctly reflected.
Changes in the Handling of Step Size for step(deg) and total(deg)
Before: Step size was 1 deg.
After: Step size is now 0.001 deg.
Since the motor reading has six decimal places of precision and EPICS supports up to seven significant figures, values up to three decimal places are now handled.
However, total(deg) currently rounds to the nearest integer due to Guardian's limitation on decimal handling.
Planned Update:
Guardian will be updated on Monday to support decimal points values.
Adjustments can be made by modifying the SCALE and INFLATE parameters in medm_hwp_calib_callback.sh.
Change in DeadBand Value
Before: Initial value was 0.002.
After: Updated to 0.003.
The error tolerance for the stop position has been relaxed.
It is hoped that this change will correct the problem of PSL HWPs failing to stop or taking too long to stop.
shift length
+1deg x 30 times, followed by -30deg x 1 time as a set, 100 times repeated to check the stop position
0.002: -0.0451725 deg
0.003: -0.0494520 deg
Change in Stop Processing
 An asynchronous process now monitors the motor movement at 0.5 sec intervals.
 If the motor rotates less than 0.1 deg, it is considered an abnormal state, and the motor is stopped.
Source Code Modifications
Updated Files:
 /opt/rtcds/userapps/sys/k1/scripts/medm_hwp_calib.sh
 Modified SSH call handling.
 EPICS values are now parameterized.
 Callback-enabled function calls added.
 Decimal points support implemented.
 /kagra/apps/agilis/agilis-p_control.py
 → Replaced with: agilis-p_control_with_callback.py
  Added motor monitoring functionality.
  Updated DeadBand value (0.002 → 0.003).
 Newly Added Files:
 /opt/rtcds/userapps/sys/k1/scripts/medm_hwp_calib_callback.sh
  Handles callback reception from k1hwp to k1script.
  Writes values to EPICS channels.
  Initialization Behavior:
When the reset command is executed or power is cycled (OFF → ON), the motor reading resets to 0.
total(deg) value is copied to base(deg).
total(deg) = motor reading + base(deg) (results in no effective change).
/kagra/apps/agilis/agilis-p_control_reset.py
Only executable on k1hwpX.
Sends a reset command to the Agilis-P controller.
After resetting, the motor initialization process in medm_hwp_calib_callback.sh runs at the next motor activation.
Note: The reset command does not change the motor position.
Important Notes
total(deg) Can No Longer Be Manually Overwritten
Before: Pressing [<>] adjusted total(deg) by adding or subtracting step(deg).
After: Pressing [<>] overwrites step(deg) with:
base(deg) + Current HWP motor position
If you need to manually adjust step(deg), update base(deg) as follows:
base(deg) = Desired angle - (total(deg) - base(deg))
Next Steps
After Guardian is updated to support decimal points values, total(deg) will be modified to accept decimal points values.