Feature/shift anti lag#225
Conversation
kferjaoui
commented
Dec 14, 2025
- Add single TEM I/O dispatcher and route fast stage moves through it
- Execute preload/overshoot + correction as an atomic sequence (no interleaving with other TEM calls)
- Keep existing UI signal wiring and TEMClient dependency unchanged
- Add single TEM I/O dispatcher and route fast stage moves through it - Execute preload/overshoot + correction as an atomic sequence (no interleaving with other TEM calls) - Keep existing UI signal wiring and TEMClient dependency unchanged
…correction - Define globals.preload (e.g. +1 µm / +1°) for two-step overshoot+return moves - Wire stage jog buttons and move_with_backlash() calls to use preload consistently - Note: current backlash/overshoot behavior is only applied on negative moves
tgruene
left a comment
There was a problem hiding this comment.
As far as I can tell, this code replaces 'backlash' with 'preload'. The backlash in task_manager.py (line 803) seems to correct for inaccuracies of the instrument, i.e. if 10um are send to pyJEM, the stage would actually only move e.g. 9.9um, and this is corrected by the backlash. This is very different from the lag-correction. in line 786 in task_manager.py sets backlash to 0 in case the stage is already in moving direction, also this seems to lead to undesired behaviour. If the user came the the crystal from the same direction, lag-correction would still be required in order to move back to the crystal after alignment 10um off the crystal, right?
- implement “parking” movements to reduce backlash: move past target by a preload margin, then step back by preload so gears are loaded in the return direction. For e.g; pushing [+10µm] moves +12µm then −2µm; [−10µm] -> −12µm then +2µm; same idea for ±TX degrees - track a per-axis net “away” displacement (accumulator) so repeated parking movements stack; Back returns in one straight move by −net_away (no preload) and then resets the accumulator. - serialize all TEM ZMQ commands through a single dispatcher lane to avoid overlapping REQ/REP calls and reduce timeouts under polling + user actions TODO: tie "back buttons" status control (enable/disable) + accumulator reset to dispatcher success via Qt queued signal/callback (currently toggled from main thread)
|
Hi Tim, To implement the “move away -> align -> move back to crystal” workflow, the new code:
So the old logic that could zero the correction: has been discarded. Because for this use case it causes the exact undesired behavior you mention: even if you approached from the same direction, you still want the “park away” move to preload the gears so the later Back is repeatable. Finally, the return is handled by the added back buttons ( Situation: The GUI allows to accumulate multiple fast movements hence the Back button will compensate for the accumulated distance i.e. if you click twice on the button [+10µm], then you will perform 2 lag-corrected moves i.e. +12µm → -2µm then 12µm → -2µm with a final state at +20µm but cogs set in the direction of (-x) and by using the button N.B: I kept the old routine |