|
125 | 125 | 5) Power cycle and the Galil should be available on the network.
|
126 | 126 | 6) Please note : do not overwrite the permanent program resident in the Galil. It can be overwritten as long as it is not made permanent. Other programs, such as homing routines can be downloaded into the device but should not be burnt in.
|
127 | 127 |
|
128 |
| -## Syncing encoder and motor steps |
| 128 | +{#galil_mot_enc_sync} |
| 129 | +### Syncing encoder and motor steps |
129 | 130 |
|
130 |
| -It can be useful to sync the motor steps to the encoder steps before each move. This is especially true with an absolute encoder where a power cycle of a Galil controller can change the motor steps to 0 but not the encoder steps because this makes the soft limits stop the motion at strange places. To do this the PV `<MOT:MTR0X0X>_MOT_ENC_SYNC_TOL_SP` should be set to a non zero value, when the difference differs by more than this tolerance the motor steps will be resynced. If the encoder is not absolute you should be cautious when doing this, the encoder and motor steps should not get out of sync so don't do it without recording the reason somewhere. |
| 131 | +The Galil keeps two counters: a motor step counter, and an encoder readback. The motor step counter corresponds to |
| 132 | +how far a given axis should have moved, given the number of motor pulses sent to it. The encoder readback is an |
| 133 | +independent position readback from the encoder. |
| 134 | + |
| 135 | +These two numbers can get out of sync with each other for various reasons, for example: |
| 136 | +- The motor may mechanically stall (motor steps will be sent; some of the sent steps will not cause corresponding motion) |
| 137 | +- Motion may be disabled by a safety system (motor steps will be sent; no physical motion will occur) |
| 138 | +- The encoder may be broken (motor steps will be sent, motion will occur, but will not be registered by the encoder) |
| 139 | + |
| 140 | +In June 2025, in [ticket 5220](https://github.com/ISISComputingGroup/IBEX/issues/5220), it was decided that the encoder |
| 141 | +would be the "source of truth" number used by IBEX (wherever an encoder is present). This means that |
| 142 | +IBEX has been set up to resync the motor position and the encoder readback before every move. |
| 143 | + |
| 144 | +This is configured using PVs of the form `MTR0101_MOT_ENC_SYNC_TOL_SP`. If the drift between the motor and encoder |
| 145 | +exceeds the limit defined by this PV, then the motor position will be resynced to the encoder readback just before a |
| 146 | +move. The drift is available in PVs of the form `MTR0101_MTRENC_DRIFT`. |
| 147 | +For most axes, a setting equal to `ERES` is appropriate - this re-syncs motor to encoder if they differ by more than one |
| 148 | +encoder pulse (which is the smallest increment accurately measurable). |
| 149 | + |
| 150 | +A [config checker test](https://github.com/ISISComputingGroup/InstrumentChecker) checks that the resync tolerance has |
| 151 | +been set. If you need to disable the resync mechanism for a particular axis, the resync tolerance should be set to an |
| 152 | +explicit large value (e.g. much larger than the total range of travel for the axis). |
| 153 | + |
| 154 | +A side effect of enabling the resync logic on every axis is that if an encoder fails, and is switched to open loop, it |
| 155 | +will need to be re-homed or re-scanned to have an accurate position. This is because it will have done a resync to the |
| 156 | +broken encoder. |
| 157 | +Even without the resync logic, the open-loop axis may have lost its absolute position, for example due to |
| 158 | +motor record retries. |
| 159 | + |
| 160 | +### Limits |
| 161 | + |
| 162 | +If the motor is on limits and a move is attempted, you will see a message in the log like: |
| 163 | +``` |
| 164 | +move begin failure axis X after XXX seconds: ... [Decelerating or stopped by FWD limit switch or soft limit FL]" |
| 165 | +``` |
| 166 | + |
| 167 | +This means that the axis is on a limit, which can be either a hard limit or a soft limit. If it is a hard limit, the |
| 168 | +hard limit indicators in IBEX (`.LLS` and `.HLS` PVs will be active) - this means that a mechanical limit switch is |
| 169 | +engaged, or that an external system has disabled motion (safety systems commonly cause both limits to show engaged). |
| 170 | + |
| 171 | +If it is a soft limit, these are set in IBEX. For axes where the [motor and encoder resync](#galil_mot_enc_sync), |
| 172 | +the internal limits in the galil should match closely with the limits set in IBEX. However, if the motor-encoder resync |
| 173 | +tolerance is set very high, it is possible for the internal galil limits to differ from those configured in IBEX. |
131 | 174 |
|
132 | 175 | ## Further Information
|
133 | 176 |
|
|
0 commit comments