|
127 | 127 |
|
128 | 128 | ## Syncing encoder and motor steps
|
129 | 129 |
|
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. |
| 130 | +The Galil keeps two counters: a motor step counter, and an encoder readback. The motor step counter corresponds to |
| 131 | +how far a given axis should have moved, given the number of motor pulses sent to it. The encoder readback is an |
| 132 | +independent position readback from the encoder. |
| 133 | + |
| 134 | +These two numbers can get out of sync with each other for various reasons, for example: |
| 135 | +- The motor may mechanically stall (motor steps will be sent; some of the sent steps will not cause corresponding motion) |
| 136 | +- Motion may be disabled by a safety system (motor steps will be sent; no physical motion will occur) |
| 137 | +- The encoder may be broken (motor steps will be sent, motion will occur, but will not be registered by the encoder) |
| 138 | + |
| 139 | +In June 2025, in [ticket 5220](https://github.com/ISISComputingGroup/IBEX/issues/5220), it was decided that the encoder |
| 140 | +would be the "source of truth" number used by IBEX (wherever an encoder is present). This means that |
| 141 | +IBEX has been set up to resync the motor position and the encoder readback before every move. |
| 142 | + |
| 143 | +This is configured using PVs of the form `MTR0101_MOT_ENC_SYNC_TOL_SP`. If the drift between the motor and encoder |
| 144 | +exceeds the limit defined by this PV, then the motor position will be resynced to the encoder readback just before a |
| 145 | +move. The drift is available in PVs of the form `MTR0101_MTRENC_DRIFT`. |
| 146 | +For most axes, a setting equal to `ERES` is appropriate - this resyncs motor to encoder if they differ by more than one |
| 147 | +encoder pulse (which is the smallest increment accurately measurable). |
| 148 | + |
| 149 | +A [config checker test](https://github.com/ISISComputingGroup/InstrumentChecker) checks that the resync tolerance has |
| 150 | +been set. If you need to disable the resync mechanism for a particular axis, the resync tolerance should be set to an |
| 151 | +explicit large value (e.g. much larger than the total range of travel for the axis). |
| 152 | + |
| 153 | +A side effect of enabling the resync logic on every axis is that if an encoder fails, and is switched to open loop, it |
| 154 | +will need to be rehomed or rescanned to have an accurate position. This is because it will have done a resync to the |
| 155 | +broken encoder. |
| 156 | +Even without the resync logic, the open-loop axis may have lost its absolute position, for example due to |
| 157 | +motor record retries. |
| 158 | + |
| 159 | +On axes where the resync logic has been disabled, by setting `MTR0101_MOT_ENC_SYNC_TOL_SP` to a large value, you may |
| 160 | +see errors of the form: |
| 161 | + |
| 162 | +``` |
| 163 | +move begin failure axis X after XXX seconds: ... [Decelerating or stopped by FWD limit switch or soft limit FL]" |
| 164 | +``` |
| 165 | + |
| 166 | +Even when the encoder readback is not close to a limit. This is because the IBEX Galil driver sets limits in the |
| 167 | +Galil based on the motor position - this means that if the motor and encoder are out of sync with each other. |
131 | 168 |
|
132 | 169 | ## Further Information
|
133 | 170 |
|
|
0 commit comments