Skip to content

Fix the PI actuator with PyMoDAQ 5.3: configurable default units, stop, axis change - #35

Open
jerlfan wants to merge 4 commits into
PyMoDAQ:mainfrom
jerlfan:fix/units-stop-multiaxes
Open

jerlfan wants to merge 4 commits into
PyMoDAQ:mainfrom
jerlfan:fix/units-stop-multiaxes

Conversation

@jerlfan

@jerlfan jerlfan commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

What

Three fixes found while using an E-517 piezo controller (3 axes, USB) with PyMoDAQ 5.3:

  1. Configurable default units. Some controllers cannot report their axis units: on the E-517, qPUN is an unknown command and parameter 0x07000601 gives a syntax error. The plugin then falls back to mm, hard-coded, whereas the E-517 works in µm, so every target was divided by 1000 (a 1 µm move commanded 1 nm). The fallback is now read from a new default_units entry of the configuration file (default 'mm', so nothing changes for other users); E-517 users set 'um'.
  2. Stop. After StopAll, PI controllers report error 10 ("controller was stopped by command"). It was raised, so move_done was never called. StopAll(noraise=True) is the option pipython provides for this case.
  3. Axis change. commit_settings looked for the multiaxes group, which no longer exists in PyMoDAQ 5.3 (the axis is in the controller group since 5.2), so changing the axis raised a KeyError and the servo state and limits were not updated. The plugin already requires pymodaq>=5.3.2, so this does not affect older versions.

Point to check, @seb5g

In the axis-change branch, I removed the call to set_referencing, which may run FRF on the selected axis: since this branch never ran with PyMoDAQ 5, fixing it as is would make a simple change of axis start a reference move on motorized controllers. Only the update of the servo state and of the limits is kept. Do you agree?

Tested

On an E-517 (3 axes, 0 to 100 µm, closed loop), PyMoDAQ 5.3.10, Python 3.12, Windows 11:

  • positions read and moves (absolute, relative) in µm with default_units = 'um';
  • Stop during a move: no error, the module stays usable;
  • change of axis A/B/C: no error, moves on the selected axis.

Remark

  • With µm units, the class default _epsilon = 0.01 is 10 nm, below the position noise of this stage (about 0.05 µm), so moves do not end by themselves until epsilon is raised in the settings. Not changed here, since the right value depends on the stage.
  • check_plugin -v: no new warning from these changes; the deprecation warnings it reports in daq_move_PI.py and in the other actuators already existed and will be handled in a follow-up PR (for daq_move_PI.py, testable on the E-517) and an issue (for the plugins I cannot test).

@jerlfan

jerlfan commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

I added a fourth change, needed to use the E-517 in a Dashboard experiment: the plugin declared no axis before connection (stage_names = ['']), so the experiment editor and AddModule could not offer A, B or C, and the axis cannot be saved in a state either. The axes offered before connection are now read from a new axis_names entry of the configuration file (empty by default, so the behaviour is unchanged for other users); at initialization the plugin still reads the actual names from the controller. This also replaces the deprecated stage_names by _axis_names.

Tested on the E-517 with axis_names = ['A', 'B', 'C']: experiment with X/Y/Z on A/B/C (one master, two slaves), each module initializes on its axis and moves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant