Xlj Fast
xlj_fast
XLJ (X-ray Liquid Jet) fast motor control with interactive keyboard interface.
Provides real-time keyboard control for liquid jet positioning with support for translational (X, Y, Z) and rotational (RX, RY, RZ) axes.
Attributes
KEYS
module-attribute
KEYS = {'up': '\x1b[A', 'down': '\x1b[B', 'right': '\x1b[C', 'left': '\x1b[D', 'shift_up': '\x1b[1;2A', 'shift_down': '\x1b[1;2B', 'shift_right': '\x1b[1;2C', 'shift_left': '\x1b[1;2D', 'plus': '+', 'equal': '=', 'minus': '-', 'under': '_'}
Classes
BypassPositionCheck
Bases: PVPositionerDone
PV positioner with position check bypass for fast movements.
Extends PVPositionerDone to skip position verification, allowing faster continuous motion for interactive control.
Components
setpoint : EpicsSignal Target position PV actuate : EpicsSignal Move command trigger
Notes
Bypassing Position Check: - Standard positioners wait for position reached - Interactive control needs immediate response - This class starts move and returns immediately - Position tracking happens asynchronously
Use Cases: - Interactive jogging - Continuous motion - Fast scanning - Real-time adjustments
Warnings
- No verification that position reached
- Responsibility on user to monitor
- Not suitable for precision positioning
Examples:
XLJController
XLJController(motors: List, orientation: str = 'horizontal', scale: float = 0.1, mode: str = 'translation')
Interactive keyboard controller for XLJ motors.
Provides real-time keyboard-based control with visual feedback and configurable step sizes.
Attributes:
| Name | Type | Description |
|---|---|---|
motors |
List
|
List of motor objects to control |
orientation |
str
|
Camera view orientation: 'horizontal' or 'vertical' |
scale |
float
|
Current step size for movements |
mode |
str
|
Control mode: 'translation', 'rotation', or '6axis' |
xlj |
BeckhoffJet
|
Full XLJ device for status monitoring |
Methods:
| Name | Description |
|---|---|
run |
Start interactive control loop |
print_help |
Display control instructions |
process_key |
Handle keyboard input |
update_scale |
Adjust step size |
Notes
Konsole compatibility: - After the GNOME -> KDE migration, Konsole does not pass through Shift+Arrow key escape sequences. - Shift+Up/Shift+Down and Shift+Right/Shift+Left remain supported as legacy keys (e.g. on gnome-terminal), but numpad-style alternatives are provided for Konsole users: 8=Shift+Up, 2=Shift+Down, 6=Shift+Right, 4=Shift+Left.
Control Modes:
Translation (X, Y, Z): - Arrow keys: Move X and Y - Shift+Up/Down (legacy) or 8/2: Move Z - Direct spatial control - Units: mm
Rotation (RX, RY, RZ): - Arrow keys: Rotate RX and RY - Shift+Up/Down (legacy) or 8/2: Rotate RZ - Angular adjustments - Units: degrees
6-Axis (X, Y, Z, RX, RY, RZ): - Arrow keys: Move X and Y - Shift+Up/Down (legacy) or 8/2: Move Z - W/S: Rotate RY (horizontal) or RX (vertical) - A/D: Rotate RX (horizontal) or RY (vertical) - Shift+W/S: Rotate RZ - Full control of all DOF - Note: W/S/A/D remain dedicated to rotation in this mode, so Z movement uses 8/2 (not W/S) to avoid a key collision on Konsole
Orientation: - Horizontal: Standard camera view - Vertical: 90° rotated camera - Affects arrow key mapping - Matches visual feedback
Step Size Control: - +/=: Double current step - -/_: Halve current step - Shift+Right (legacy) or 6: Double step - Shift+Left (legacy) or 4: Halve step - Dynamic adjustment during use
Visual Feedback: - Current positions displayed - Step size shown - Motor names labeled - Updates after each move
Examples:
Create controller:
>>> from xlj_fast import XLJController
>>> motors = [xlj_x, xlj_y, xlj_z]
>>> ctrl = XLJController(motors, 'horizontal', 0.1, 'translation')
>>> ctrl.run()
See Also
xlj_fast : Translation control function xlj_fast_rot : Rotation control function xlj_6axis : Full 6-axis control function
Initialize XLJ controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
motors
|
List
|
Motor objects to control |
required |
orientation
|
str
|
Camera orientation. Default is 'horizontal'. |
'horizontal'
|
scale
|
float
|
Initial step size. Default is 0.1. |
0.1
|
mode
|
str
|
Control mode. Default is 'translation'. |
'translation'
|
Source code in mfx/xlj_fast.py
Attributes
scale_keys
property
Return tuple of scale adjustment keys.
'4'/'6' are Konsole-friendly numpad alternatives to the legacy Shift+Left/Shift+Right keys for halving/doubling the step size.
Functions
ensure_synced_before_move
OG behavior: compare jet readback to fast motor readback. If mismatch, log error and resync motor to jet position.
Source code in mfx/xlj_fast.py
execute_move
Execute a relative move for the motor identified by axis
(x,y,z,rx,ry,rz) with OG-style X/Y/Z sync check + resync.
Source code in mfx/xlj_fast.py
format_status_line
Source code in mfx/xlj_fast.py
print_help
Display control instructions.
Note: On Konsole (KDE's terminal, used after the GNOME -> KDE migration), Shift+Arrow key combinations are not passed through to the application. Use the numpad-style alternatives below (8/2/4/6) instead when running under Konsole.
Source code in mfx/xlj_fast.py
print_status_line
run
Interactive control loop with OG-style one-line status output. - Status line updates in-place using ESC[2K + \r - Press 'h' prints the full help (your print_help) and returns to status line - Unknown keys print help (like OG)
Source code in mfx/xlj_fast.py
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | |
update_scale
Update step size by multiplication factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
factor
|
float
|
Multiplication factor (e.g., 2.0 to double, 0.5 to halve) |
required |
Source code in mfx/xlj_fast.py
Functions
xlj_6axis
Interactive XLJ 6-axis control (X, Y, Z, RX, RY, RZ).
Provides complete keyboard-based control for all liquid jet degrees of freedom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orientation
|
str
|
Camera view. Default is 'horizontal'. |
'horizontal'
|
scale
|
float
|
Initial step size (mm for translation, deg for rotation). Default is 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
None
|
|
Notes
Controls: - Arrow keys: Move X and Y - Shift+↑ ↓ (legacy) or 8/2 : Move Z - W/S: Rotate RY (horizontal) or RX (vertical) - A/D: Rotate RX (horizontal) or RY (vertical) - Shift+W/S: Rotate RZ - ± or Shift+→/← (legacy) or 6/4 : Adjust step size - h : Help - q : Quit
Konsole note: Shift+Arrow keys do not register on Konsole (KDE's terminal, used since the GNOME -> KDE migration). Use the numpad keys 8/2 (Z move) and 4/6 (step size) instead. W/S/A/D remain dedicated to RY/RX rotation in this mode, so Z movement uses 8/2 rather than W/S to avoid a key collision.
Examples:
See Also
xlj_fast : Translation only xlj_fast_rot : Rotation only
Source code in mfx/xlj_fast.py
xlj_fast
Interactive XLJ translation control (X, Y, Z).
Provides keyboard-based control for liquid jet X, Y, and Z positioning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orientation
|
str
|
Camera view: 'horizontal' or 'vertical'. Default is 'horizontal'. |
'horizontal'
|
scale
|
float
|
Initial step size in mm. Default is 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
None
|
|
Notes
Controls: - Arrow keys: Move X and Y - Shift+↑ ↓ (legacy) or 8/2 : Move Z upstream/downstream - ± or Shift+→/← (legacy) or 6/4 : Adjust step size - h : Help - q : Quit
Konsole note: Shift+Arrow keys do not register on Konsole (KDE's terminal, used since the GNOME -> KDE migration). Use the numpad keys 8/2 (Z move) and 4/6 (step size) instead.
Examples:
See Also
xlj_fast_rot : Rotation control xlj_6axis : Full 6-axis control
Source code in mfx/xlj_fast.py
xlj_fast_rot
Interactive XLJ rotation control (RX, RY, RZ).
Provides keyboard-based control for liquid jet rotation axes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
orientation
|
str
|
Camera view. Default is 'horizontal'. |
'horizontal'
|
scale
|
float
|
Initial step size in degrees. Default is 0.1. |
0.1
|
Returns:
| Type | Description |
|---|---|
None
|
|
Notes
Controls: - Arrow keys: Rotate RX and RY - Shift+↑ ↓ (legacy) or 8/2 : Rotate RZ - ± or Shift+→/← (legacy) or 6/4 : Adjust step size - h : Help - q : Quit
Konsole note: Shift+Arrow keys do not register on Konsole (KDE's terminal, used since the GNOME -> KDE migration). Use the numpad keys 8/2 (RZ rotate) and 4/6 (step size) instead.
Examples:
See Also
xlj_fast : Translation control xlj_6axis : Full 6-axis control