plesty-anc300-piezo-controller 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. plesty_anc300_piezo_controller-0.1.0/.env.example +28 -0
  2. plesty_anc300_piezo_controller-0.1.0/.gitignore +71 -0
  3. plesty_anc300_piezo_controller-0.1.0/.gitlab-ci.yml +16 -0
  4. plesty_anc300_piezo_controller-0.1.0/CHANGELOG.md +32 -0
  5. plesty_anc300_piezo_controller-0.1.0/LICENSE +184 -0
  6. plesty_anc300_piezo_controller-0.1.0/LICENSES/LGPL-3.0-or-later.txt +165 -0
  7. plesty_anc300_piezo_controller-0.1.0/PKG-INFO +156 -0
  8. plesty_anc300_piezo_controller-0.1.0/README.md +143 -0
  9. plesty_anc300_piezo_controller-0.1.0/REUSE.toml +11 -0
  10. plesty_anc300_piezo_controller-0.1.0/docs/index.md +193 -0
  11. plesty_anc300_piezo_controller-0.1.0/docs/toc.yaml +9 -0
  12. plesty_anc300_piezo_controller-0.1.0/gl-secret-detection-report.json +50 -0
  13. plesty_anc300_piezo_controller-0.1.0/packaging/versioning.py +72 -0
  14. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/__init__.py +33 -0
  15. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/__main__.py +249 -0
  16. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/base_device.py +448 -0
  17. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/config.yaml +12 -0
  18. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/device.py +306 -0
  19. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/errors.py +27 -0
  20. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/mock_solver.py +222 -0
  21. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/preflight.py +392 -0
  22. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/schema_func.json +93 -0
  23. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/schema_param.json +191 -0
  24. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/serial_traffic.py +294 -0
  25. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/solver.py +439 -0
  26. plesty_anc300_piezo_controller-0.1.0/plesty/anc300_piezo_controller/traffic.py +182 -0
  27. plesty_anc300_piezo_controller-0.1.0/pyproject.toml +74 -0
  28. plesty_anc300_piezo_controller-0.1.0/reports/check.json +176 -0
  29. plesty_anc300_piezo_controller-0.1.0/tests/__init__.py +4 -0
  30. plesty_anc300_piezo_controller-0.1.0/tests/test_device_mock.py +564 -0
  31. plesty_anc300_piezo_controller-0.1.0/tests/test_main_cli.py +58 -0
  32. plesty_anc300_piezo_controller-0.1.0/tests/test_mock_pipeline.py +48 -0
  33. plesty_anc300_piezo_controller-0.1.0/tests/test_preflight.py +316 -0
  34. plesty_anc300_piezo_controller-0.1.0/tests/test_serial_traffic.py +321 -0
  35. plesty_anc300_piezo_controller-0.1.0/tests/test_solver.py +347 -0
  36. plesty_anc300_piezo_controller-0.1.0/tests/test_traffic.py +333 -0
  37. plesty_anc300_piezo_controller-0.1.0/uv.lock +2240 -0
@@ -0,0 +1,28 @@
1
+ # Device connection credentials — copy to `.env` and fill in for your setup.
2
+ # Loaded by plesty.lib.utils.EnvSettings; the process environment overrides `.env`.
3
+ # The same `.env` drives both the standalone server and the real-device tests.
4
+
5
+ # Target device endpoint: DEVICE_ADDRESS for a controller on USB/RS232, or
6
+ # DEVICE_HOST + DEVICE_PORT (7230) for one on Ethernet.
7
+ DEVICE_HOST=
8
+ DEVICE_PORT=
9
+
10
+ # ANC300 console login. LAN consoles (port 7230) ask for a password on
11
+ # connect; the factory default is in the vendor manual (IV.2). Leave empty
12
+ # for the USB/RS232 console, which asks for none.
13
+ DEVICE_PASSWORD=
14
+
15
+ # Serial port of a controller on USB or RS232 (COM5, /dev/ttyACM0). When set it
16
+ # wins over DEVICE_HOST/DEVICE_PORT. Also read by tests/field_test.py, which
17
+ # must never carry it: an address can contain a serial number and this repo is
18
+ # world-readable, while `.env` is git-ignored.
19
+ DEVICE_ADDRESS=
20
+
21
+ # ZMQ port this device server binds for remote clients
22
+ DEVICE_TCP_PORT=5555
23
+
24
+ # Shared location every field-test run is also copied to (optional). The local
25
+ # reports under reports/ stay authoritative; this second copy is what puts the
26
+ # full markdown report — host, address, serial — where colleagues and tools can
27
+ # read it, without it ever entering git. Unset means local only.
28
+ PLESTY_REPORT_ARCHIVE=
@@ -0,0 +1,71 @@
1
+ # Custom
2
+ .deprecated/
3
+ logs/
4
+ runs/
5
+
6
+ # Field test and check reports. The JSON documents are the published
7
+ # artifacts — hub.plesty.net and manager.plesty.net read them, so they are
8
+ # committed. The markdown and JSONL forms are for whoever ran the test: they
9
+ # carry the host name, the instrument address, its serial and the lab's file
10
+ # paths, and a hub repository is world-readable.
11
+ # An interrupted `plesty init field-test` leaves its answers here.
12
+ .plesty-field-test.partial.json
13
+
14
+ reports/**/*.md
15
+ reports/**/*.jsonl
16
+ reports/*.md
17
+ reports/*.jsonl
18
+
19
+ # Auto-generated device reference pages (regenerated by `plesty docs`)
20
+ docs/_generated/
21
+
22
+ # Python bytecode and caches
23
+ __pycache__/
24
+ *.py[cod]
25
+ *$py.class
26
+
27
+ # C extensions and shared libraries
28
+ *.so
29
+ *.pyd
30
+ *.dll
31
+
32
+ # Packaging and build artifacts
33
+ build/
34
+ dist/
35
+ *.egg-info/
36
+ .eggs/
37
+
38
+ # Local credentials — keep `.env.example` tracked, never the real `.env`
39
+ .env
40
+
41
+ # Virtual environments
42
+ .venv/
43
+ venv/
44
+ env/
45
+ ENV/
46
+ .uv_cache/
47
+
48
+ # Test and coverage outputs
49
+ .pytest_cache/
50
+ .coverage
51
+ .coverage.*
52
+ htmlcov/
53
+ .mypy_cache/
54
+ .ruff_cache/
55
+
56
+ # Jupyter
57
+ .ipynb_checkpoints/
58
+
59
+ # Logs and runtime files
60
+ *.log
61
+ *.pid
62
+
63
+ # IDE/editor
64
+ .vscode/
65
+ .idea/
66
+ *.swp
67
+ *.swo
68
+
69
+ # OS files
70
+ .DS_Store
71
+ Thumbs.db
@@ -0,0 +1,16 @@
1
+ stages:
2
+ - check
3
+ - security
4
+ - deploy
5
+ - release
6
+
7
+ variables:
8
+ # Required for versioningit: the runner must fetch full Git history and tags.
9
+ GIT_DEPTH: "0"
10
+
11
+ include:
12
+ - component: $CI_SERVER_FQDN/plesty/plesty-ci/plesty-standard-ci@main
13
+ inputs:
14
+ standard: quantum
15
+ extra_branch: exp
16
+ access_token: $CI_BOT_TOKEN
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ The format is based on [Keep a Changelog](https://keepachangelog.com).
4
+
5
+ ## [0.1.0] — 2026-10-27
6
+
7
+ The first release, opening the 0.1 line. Written from the vendor manual and
8
+ tested against the module's simulator; run on an ANC300 with ANM200 axes over
9
+ USB on the bench since 2026-10-12, driving the fine alignment of
10
+ `plesty-nav-pow-pol-pl`.
11
+
12
+ ### Added
13
+ - **Device for the Attocube ANC300 over its USB or Ethernet console**: a serial port (`serial_port="COM5"`, 38400 baud, no login; the `> ` prompt the USB console prints is discarded) or TCP port 7230 with a password login. With `axis_1` to `axis_7` parameter groups. Per axis: `mode` (`gnd`, `off`, `inp`, `stp`, `stp+`, `stp-`), `offset_voltage` (0 to 150 V) and `filter`. By default axes 1 and 2 are exposed (`axes=` selects others).
14
+ - **Operations** `get_info`, `get_output_voltage`, `get_capacitance`, `wait_capacitance` and `stop`, and the composed `measure_capacitance`, `ramp_offset`, `shift_offset`, `move_xy`, `shift_xy` and `shutdown_to_ground`. `ramp_offset` moves the offset in equal steps and `shift_offset` by a difference; `move_xy` and `shift_xy` ramp the x and y axes together (`xy_axes=`, `--xy-axes`; axes 1 and 2 by default), taking over `move_2d_total`, `move_2d_delta` and `single_step` of the plexy ANC300 driver, except that a target outside the allowed range is refused rather than clipped; `shutdown_to_ground` brings the offset to zero before grounding. Disconnecting (also when the server stops) ramps every selected axis's offset to 0 V and keeps its mode, so an offset is never left non-zero.
15
+ - **A frozen USB console is reported, not waited on.** The console can stop in the middle of a reply, and a read on it then stays in the Windows driver for minutes. Replies are now read by a thread of their own, so every wait ends on time; a read stuck for 2 s, or a command the console does not take within the timeout, raises "power-cycle the controller", and every later command is refused at once instead of each waiting out its timeout. A failed exchange logs the console lines sent and received since the last failure.
16
+ - **50 ms between commands** to the controller (`COMMAND_GAP_S`): the USB console froze twice under commands sent back to back and never with measurements 10 s apart. A ramp's `duration` is therefore a minimum: each step costs at least 50 ms per axis, so `move_xy` with its default 100 steps takes about 11 s, and the ramp to 0 V on disconnect about 6 s for two axes. The simulator runs without the pause.
17
+ - **A ramp ends exactly on its target.** Its last step writes the target itself and every step is kept within 0 to `max_offset_voltage`: a ramp to 0 V used to end a rounding below it (−1.8e-15 V), and that write was refused as out of range (bench, 2026-10-15).
18
+ - **`max_offset_voltage`** (and `--max-offset-voltage`): a lower limit than the controller's 150 V on the offset this device will write.
19
+ - **Anc300Simulator**: `host="mock"` (also `sim`, `simulator`) runs the protocol in memory for tests and for use without hardware.
20
+ - **Server entry point** `python -m plesty.anc300_piezo_controller` with `--axes`, `--max-offset-voltage`, `--serial-port`, `--baudrate`, `--gui` and `--skip-preflight`; connection settings come from `DEVICE_ADDRESS` (the serial port, which wins when set) or `DEVICE_HOST`, `DEVICE_PORT` and `DEVICE_PASSWORD`, plus `DEVICE_TCP_PORT`. Before the server binds, the preflight checks that the operating system lists the serial port (naming the ports it does see if not), or that the controller's host resolves and its port accepts. It opens neither.
21
+ - `Anc300Error`, raised when the console answers `ERROR` or not at all. On USB a write the console does not take within the timeout raises it too ("its USB console has stopped reading"), and closing drops unsent output first, so a stalled console fails the command, the connect or the shutdown instead of hanging the server with the port held.
22
+ - `packaging/versioning.py` (`plesty update --versioning`): a snapshot build is named for the release its line is working towards.
23
+
24
+ ### Known limits
25
+ - RS232 is assumed to behave like USB (38400 baud, 8N1) and has not been tried.
26
+ - Stepping commands, the AC/DC-IN switches, pulse counts, triggers, `setfc`, `getser`, `help` and the Lua console are not exposed.
27
+ - Unverified on hardware: reply shapes of `getm`, `geta` and `getfil`, the end of the Ethernet login banner, the format of `getcser`, and the behaviour on a wrong password. The filter list is the ANM200 one; an ANM300 rejects 1.6 and 1600. (`getc` reads `capacitance = <value> nF`, verified 2026-10-12.)
28
+
29
+ ### Security
30
+ - **pillow 13.0.0, certifi 2026.10.23 and brotli 1.2.1 in the lockfile**, past
31
+ the advisories against pillow 12.3.0, certifi 2026.7.22 and brotli 1.2.0
32
+ (PYSEC-2026-4322).
@@ -0,0 +1,184 @@
1
+ Copyright (C) 2026 Plesty Development Team
2
+
3
+ This file is part of Plesty.
4
+
5
+ Plesty is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU Lesser General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ Plesty is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with Plesty. If not, see <https://www.gnu.org/licenses/> or the copy below.
17
+
18
+ #########################################################################
19
+
20
+ GNU LESSER GENERAL PUBLIC LICENSE
21
+ Version 3, 29 June 2007
22
+
23
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
24
+ Everyone is permitted to copy and distribute verbatim copies
25
+ of this license document, but changing it is not allowed.
26
+
27
+
28
+ This version of the GNU Lesser General Public License incorporates
29
+ the terms and conditions of version 3 of the GNU General Public
30
+ License, supplemented by the additional permissions listed below.
31
+
32
+ 0. Additional Definitions.
33
+
34
+ As used herein, "this License" refers to version 3 of the GNU Lesser
35
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
36
+ General Public License.
37
+
38
+ "The Library" refers to a covered work governed by this License,
39
+ other than an Application or a Combined Work as defined below.
40
+
41
+ An "Application" is any work that makes use of an interface provided
42
+ by the Library, but which is not otherwise based on the Library.
43
+ Defining a subclass of a class defined by the Library is deemed a mode
44
+ of using an interface provided by the Library.
45
+
46
+ A "Combined Work" is a work produced by combining or linking an
47
+ Application with the Library. The particular version of the Library
48
+ with which the Combined Work was made is also called the "Linked
49
+ Version".
50
+
51
+ The "Minimal Corresponding Source" for a Combined Work means the
52
+ Corresponding Source for the Combined Work, excluding any source code
53
+ for portions of the Combined Work that, considered in isolation, are
54
+ based on the Application, and not on the Linked Version.
55
+
56
+ The "Corresponding Application Code" for a Combined Work means the
57
+ object code and/or source code for the Application, including any data
58
+ and utility programs needed for reproducing the Combined Work from the
59
+ Application, but excluding the System Libraries of the Combined Work.
60
+
61
+ 1. Exception to Section 3 of the GNU GPL.
62
+
63
+ You may convey a covered work under sections 3 and 4 of this License
64
+ without being bound by section 3 of the GNU GPL.
65
+
66
+ 2. Conveying Modified Versions.
67
+
68
+ If you modify a copy of the Library, and, in your modifications, a
69
+ facility refers to a function or data to be supplied by an Application
70
+ that uses the facility (other than as an argument passed when the
71
+ facility is invoked), then you may convey a copy of the modified
72
+ version:
73
+
74
+ a) under this License, provided that you make a good faith effort to
75
+ ensure that, in the event an Application does not supply the
76
+ function or data, the facility still operates, and performs
77
+ whatever part of its purpose remains meaningful, or
78
+
79
+ b) under the GNU GPL, with none of the additional permissions of
80
+ this License applicable to that copy.
81
+
82
+ 3. Object Code Incorporating Material from Library Header Files.
83
+
84
+ The object code form of an Application may incorporate material from
85
+ a header file that is part of the Library. You may convey such object
86
+ code under terms of your choice, provided that, if the incorporated
87
+ material is not limited to numerical parameters, data structure
88
+ layouts and accessors, or small macros, inline functions and templates
89
+ (ten or fewer lines in length), you do both of the following:
90
+
91
+ a) Give prominent notice with each copy of the object code that the
92
+ Library is used in it and that the Library and its use are
93
+ covered by this License.
94
+
95
+ b) Accompany the object code with a copy of the GNU GPL and this license
96
+ document.
97
+
98
+ 4. Combined Works.
99
+
100
+ You may convey a Combined Work under terms of your choice that,
101
+ taken together, effectively do not restrict modification of the
102
+ portions of the Library contained in the Combined Work and reverse
103
+ engineering for debugging such modifications, if you also do each of
104
+ the following:
105
+
106
+ a) Give prominent notice with each copy of the Combined Work that
107
+ the Library is used in it and that the Library and its use are
108
+ covered by this License.
109
+
110
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
111
+ document.
112
+
113
+ c) For a Combined Work that displays copyright notices during
114
+ execution, include the copyright notice for the Library among
115
+ these notices, as well as a reference directing the user to the
116
+ copies of the GNU GPL and this license document.
117
+
118
+ d) Do one of the following:
119
+
120
+ 0) Convey the Minimal Corresponding Source under the terms of this
121
+ License, and the Corresponding Application Code in a form
122
+ suitable for, and under terms that permit, the user to
123
+ recombine or relink the Application with a modified version of
124
+ the Linked Version to produce a modified Combined Work, in the
125
+ manner specified by section 6 of the GNU GPL for conveying
126
+ Corresponding Source.
127
+
128
+ 1) Use a suitable shared library mechanism for linking with the
129
+ Library. A suitable mechanism is one that (a) uses at run time
130
+ a copy of the Library already present on the user's computer
131
+ system, and (b) will operate properly with a modified version
132
+ of the Library that is interface-compatible with the Linked
133
+ Version.
134
+
135
+ e) Provide Installation Information, but only if you would otherwise
136
+ be required to provide such information under section 6 of the
137
+ GNU GPL, and only to the extent that such information is
138
+ necessary to install and execute a modified version of the
139
+ Combined Work produced by recombining or relinking the
140
+ Application with a modified version of the Linked Version. (If
141
+ you use option 4d0, the Installation Information must accompany
142
+ the Minimal Corresponding Source and Corresponding Application
143
+ Code. If you use option 4d1, you must provide the Installation
144
+ Information in the manner specified by section 6 of the GNU GPL
145
+ for conveying Corresponding Source.)
146
+
147
+ 5. Combined Libraries.
148
+
149
+ You may place library facilities that are a work based on the
150
+ Library side by side in a single library together with other library
151
+ facilities that are not Applications and are not covered by this
152
+ License, and convey such a combined library under terms of your
153
+ choice, if you do both of the following:
154
+
155
+ a) Accompany the combined library with a copy of the same work based
156
+ on the Library, uncombined with any other library facilities,
157
+ conveyed under the terms of this License.
158
+
159
+ b) Give prominent notice with the combined library that part of it
160
+ is a work based on the Library, and explaining where to find the
161
+ accompanying uncombined form of the same work.
162
+
163
+ 6. Revised Versions of the GNU Lesser General Public License.
164
+
165
+ The Free Software Foundation may publish revised and/or new versions
166
+ of the GNU Lesser General Public License from time to time. Such new
167
+ versions will be similar in spirit to the present version, but may
168
+ differ in detail to address new problems or concerns.
169
+
170
+ Each version is given a distinguishing version number. If the
171
+ Library as you received it specifies that a certain numbered version
172
+ of the GNU Lesser General Public License "or any later version"
173
+ applies to it, you have the option of following the terms and
174
+ conditions either of that published version or of any later version
175
+ published by the Free Software Foundation. If the Library as you
176
+ received it does not specify a version number of the GNU Lesser
177
+ General Public License, you may choose any version of the GNU Lesser
178
+ General Public License ever published by the Free Software Foundation.
179
+
180
+ If the Library as you received it specifies that a proxy can decide
181
+ whether future versions of the GNU Lesser General Public License shall
182
+ apply, that proxy's public statement of acceptance of any version is
183
+ permanent authorization for you to choose that version for the
184
+ Library.
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.5
2
+ Name: plesty-anc300-piezo-controller
3
+ Version: 0.1.0
4
+ Summary: A plesty anc300 piezo controller device.
5
+ Author-email: Yunshuang Yuan <yuanyunshuang@gmail.com>
6
+ Maintainer-email: Plesty Development Team <plesty.dev@example.com>
7
+ License-Expression: LGPL-3.0-or-later
8
+ License-File: LICENSE
9
+ License-File: LICENSES/LGPL-3.0-or-later.txt
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: plesty-lib>=0.5.0
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Plesty ANC300 Piezo Controller Device
15
+
16
+ A PLESTY device module for the Attocube ANC300 piezo controller. It drives the
17
+ controller's analog outputs: each axis can be grounded, set to a DC offset
18
+ voltage, filtered, and its positioner's capacitance measured. All of it is
19
+ reachable from Python and, through the PLESTY device server, over the network.
20
+
21
+ The module talks to the controller's text console, over USB (a serial port, no
22
+ login) or Ethernet (a login session on TCP port 7230): you send one command per
23
+ line and the controller answers with data lines and then a final `OK` or `ERROR`
24
+ line.
25
+
26
+ ## Supported hardware
27
+
28
+ | Part | Support |
29
+ |---|---|
30
+ | ANC300 controller, USB console (serial port, 38400 baud) | Supported |
31
+ | ANC300 controller, Ethernet console (TCP 7230) | Supported |
32
+ | ANC300 controller, RS232 console | Assumed to behave like USB; not tried |
33
+ | ANM200 axis module | Supported, including the filters 1.6, 16, 160 and 1600 Hz |
34
+ | ANM300 axis module | Supported; it accepts only the filters off, 16 and 160 Hz, and rejects the others with `ERROR` |
35
+
36
+ An ANC300 has up to seven axes, one per module slot. By default the module
37
+ exposes axes 1 and 2; pass `axes=(1, 2, 3, ...)` to expose others.
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ git clone https://gitlab.com/plesty/hub/devices/attocube/plesty-anc300-piezo-controller.git
43
+ cd plesty-anc300-piezo-controller
44
+ uv sync
45
+ ```
46
+
47
+ ## Quick start
48
+
49
+ Without hardware, `host="mock"` selects an in-memory simulator that follows the
50
+ same protocol:
51
+
52
+ ```python
53
+ from plesty.anc300_piezo_controller import Device
54
+
55
+ with Device(host="mock", axes=(1, 2)) as device:
56
+ device.write("axis_1.mode", "off") # offset-voltage mode
57
+ device.ramp_offset(axis=1, voltage=5.0) # move gently to 5 V
58
+ print(device.query("axis_1.offset_voltage")) # 5.0
59
+ print(device.measure_capacitance(axis=1)) # {"axis": 1, "capacitance": ...}
60
+ device.shutdown_to_ground() # zero the offsets, mode gnd
61
+ ```
62
+
63
+ With a controller, give its serial port (USB) or its address and password
64
+ (Ethernet), not both:
65
+
66
+ ```python
67
+ Device(serial_port="COM5", axes=(1, 2)) # USB
68
+ Device(host="192.168.1.10", port=7230, password="...", axes=(1, 2)) # Ethernet
69
+ ```
70
+
71
+ ## Run as a server
72
+
73
+ Copy `.env.example` to `.env` and set the controller's connection:
74
+ `DEVICE_ADDRESS` (the serial port, e.g. `COM5`) for USB, or `DEVICE_HOST`,
75
+ `DEVICE_PORT` (7230) and `DEVICE_PASSWORD` for Ethernet. `DEVICE_TCP_PORT` is
76
+ the port the server binds (default 5555). Then:
77
+
78
+ ```bash
79
+ cp .env.example .env
80
+ uv run python -m plesty.anc300_piezo_controller --axes 1,2 --max-offset-voltage 100
81
+ ```
82
+
83
+ `--serial-port` and `--baudrate` override the serial settings. Each value
84
+ resolves as command line, then environment, then default. Before binding, the
85
+ server checks that the controller is there: the serial port is listed by the
86
+ operating system, or the host resolves and its port accepts a connection. It
87
+ stops with the reason if not; `--skip-preflight` serves anyway. `--gui` opens a control panel instead of serving (needs the `gui` extra:
88
+ `uv sync --extra gui`). The controller grants one console session, so serve or
89
+ use the panel, not both.
90
+
91
+ ## Schema reference
92
+
93
+ Parameters exist once per axis, as `axis_<n>.<name>` (n = 1 to 7).
94
+
95
+ | Parameter | Type | Unit | Range / options | Controller commands |
96
+ |---|---|---|---|---|
97
+ | `mode` | str | | `gnd`, `off`, `inp`, `stp`, `stp+`, `stp-` | `setm` / `getm` |
98
+ | `offset_voltage` | float | V | 0 to 150 (lower with `max_offset_voltage`) | `seta` / `geta` |
99
+ | `filter` | str | Hz | `off`, `1.6`, `16`, `160`, `1600` | `setfil` / `getfil` |
100
+
101
+ Operations:
102
+
103
+ | Operation | Returns | Controller commands |
104
+ |---|---|---|
105
+ | `get_info()` | firmware `version`, board `serial` | `ver`, `getcser` |
106
+ | `get_output_voltage(axis)` | measured output voltage, V | `geto` |
107
+ | `get_capacitance(axis)` | saved capacitance, nF | `getc` |
108
+ | `wait_capacitance(axis)` | blocks until a measurement ends | `capw` |
109
+ | `stop(axis)` | stops any motion on the axis | `stop` |
110
+ | `measure_capacitance(axis)` | fresh capacitance, nF; restores mode and offset | `setm cap`, `capw`, `getc` |
111
+ | `ramp_offset(axis, voltage, steps=100, duration=1.0)` | offset read back after the ramp | `seta` repeatedly |
112
+ | `shift_offset(axis, delta, steps=10, duration=0.1)` | offset read back after the shift | `geta`, then `seta` repeatedly |
113
+ | `move_xy(x, y, steps=100, duration=1.0)` | x and y offsets read back | `seta` on both axes, in lockstep |
114
+ | `shift_xy(dx, dy, steps=10, duration=0.1)` | x and y offsets read back | `geta`, then `seta` on both axes |
115
+ | `shutdown_to_ground()` | grounded axes | `stop`, `seta`, `setm gnd` |
116
+
117
+ Disconnecting ramps every selected axis's offset to 0 V and leaves its mode as it is; an
118
+ offset is never left non-zero, because a controller that loses power or freezes drops it
119
+ to zero in one jump. Call `shutdown_to_ground()` to also ground the axes.
120
+ The full generated reference is in `docs/`.
121
+
122
+ ## Communication requirements
123
+
124
+ | | |
125
+ |---|---|
126
+ | Transport | USB serial port, 38400 baud 8N1; or TCP, controller port 7230 (Ethernet console) |
127
+ | Login | USB: none. Ethernet: password on connect (`DEVICE_PASSWORD`); the factory default is in the vendor manual |
128
+ | Framing | One command per line, CR LF; replies end with `OK` or `ERROR`, followed on USB by a `> ` prompt |
129
+ | Reply time | About 30 ms; the module waits up to 5 s, and 60 s for `capw` |
130
+
131
+ ## Not yet verified on hardware
132
+
133
+ This module was written from the vendor manual and tested against its simulator;
134
+ the first bench session checks these points. See `docs/index.md` for detail.
135
+
136
+ - The shape of the replies to `getm`, `geta`, `getfil` and `getc`. Only
137
+ `voltage = 2.345000 V` is documented; the others are assumed to be `key = value`.
138
+ - The capacitance unit, assumed to be nF.
139
+ - The text printed after login has no known end, so it is read until the line has
140
+ been quiet for 0.5 s.
141
+ - The reply format of `getcser`. (`ver` was seen over USB.)
142
+ - The filter list is the ANM200 one.
143
+ - What the controller does on a wrong password.
144
+
145
+ ## Left out on purpose
146
+
147
+ Stepping (`setf`, `getf`, `setv`, `getv`, `stepu`, `stepd`, `stepw`), the
148
+ AC/DC-IN switches (`setaci`, `getaci`, `setdci`, `getdci`), the pulse-count
149
+ commands (`setpu`, `setpd`, `getpu`, `getpd`), the trigger commands, `setfc`,
150
+ `getser`, `help` and the Lua console on port 7231. Stepping moves positioners
151
+ under load and needs a design of its own. The stepping modes `stp`, `stp+` and
152
+ `stp-` can be selected, but nothing drives steps.
153
+
154
+ ## License
155
+
156
+ LGPL-3.0-or-later.