microcmm 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.
@@ -0,0 +1,17 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ jobs:
8
+ checks:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v5
13
+ - run: uv sync --all-groups
14
+ - run: uv run ruff check src tests
15
+ - run: uv run ruff format --check src tests
16
+ - run: uv run mypy src tests
17
+ - run: uv run pytest -q
@@ -0,0 +1,28 @@
1
+ name: release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ checks:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: astral-sh/setup-uv@v5
13
+ - run: uv sync --all-groups
14
+ - run: uv run ruff check src tests
15
+ - run: uv run mypy src tests
16
+ - run: uv run pytest -q
17
+
18
+ publish:
19
+ needs: checks
20
+ runs-on: ubuntu-latest
21
+ environment: pypi
22
+ permissions:
23
+ id-token: write
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: astral-sh/setup-uv@v5
27
+ - run: uv build
28
+ - run: uv publish
@@ -0,0 +1,221 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
201
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
203
+ # you could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
221
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.12
microcmm-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Greg Sadetsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: microcmm
3
+ Version: 0.1.0
4
+ Summary: Python library + CLI for MicroScribe-3D digitizer arms (RS-232, no Windows DLL)
5
+ Project-URL: Repository, https://github.com/Revise-Robotics/microcmm
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.12
9
+ Requires-Dist: pyserial>=3.5
10
+ Description-Content-Type: text/markdown
11
+
12
+ # microcmm
13
+
14
+ Python library + CLI for reading positions from a MicroScribe-3D digitizer arm
15
+ over its RS-232 serial port. Speaks the Immersion HCI protocol directly (no
16
+ Windows DLL) and does the forward kinematics on the host using the arm's own
17
+ EEPROM calibration. Millimeters everywhere.
18
+
19
+ ## Install
20
+
21
+ ```
22
+ pip install microcmm
23
+ # or
24
+ uv add microcmm
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ from microcmm import MicroScribe
31
+
32
+ with MicroScribe("/dev/cu.usbserial-XXXX") as ms:
33
+ # You should be homing right now: arm in its home pose (stylus seated
34
+ # in the holder and vertical, counterweight against the stylus holder).
35
+ ms.home()
36
+ # (Advanced: ms.assume_homed() if the arm is already homed this power cycle.)
37
+ print(ms.info.serial_number)
38
+ p = ms.pose()
39
+ print(p.x, p.y, p.z)
40
+ ```
41
+
42
+ ## CLI
43
+
44
+ ```
45
+ microcmm <command>
46
+ ```
47
+
48
+ - `info` - identify the arm, dump its calibration constants
49
+ - `point` - read one stylus position
50
+ - `stream` - continuously print positions
51
+ - `capture -o points.csv` - capture points on keypress, write CSV
52
+ - `dist` - measure distances between captured point pairs
53
+ - `home` - set the home position (arm must be in its home pose)
54
+ - `ports` - list serial ports
55
+
56
+ ## Notes
57
+
58
+ - **Homing is mandatory.** The arm only reads correctly if it was in its home
59
+ pose (stylus seated in the holder and vertical, counterweight pressed
60
+ against the bottom of the stylus holder) at power-on or when `home` was
61
+ sent. This is lost at every power cycle. The library refuses to return
62
+ positions until you call `home()` or explicitly `assume_homed()` - an
63
+ unhomed arm produces garbage that looks plausible.
64
+ - **Only tested on a MicroScribe-3D model D (5-DOF).** The library refuses
65
+ other models by precaution, not because they can't work - if you have one,
66
+ run with `allow_untested_models=True` and report back, we'll add it.
67
+ - **Pedals are not implemented** because we don't have one. The raw button
68
+ byte is exposed on every packet if you want to try.
69
+ - 5-DOF arms have no roll about the stylus axis; the reported orientation
70
+ (XYZ-fixed roll/pitch/yaw) reflects that.
71
+ - Accuracy validated with a 45-point single-divot pivot test: 0.66 mm RMS.
72
+ Avoid poses with the stylus aligned with the forearm (singularity).
73
+ - Not implemented, on purpose: analog channels, baud switching, EEPROM
74
+ writes (SET_PARAMS / SET_HOME / RESTORE_FACTORY), motion-report streaming,
75
+ custom tip offsets (MSTIP.DAT). Ask if you need one.
76
+
77
+ ## Dev
78
+
79
+ Install dependencies with `uv sync`, then:
80
+
81
+ ```
82
+ uv run pytest
83
+ uv run ruff check src tests
84
+ uv run mypy src tests
85
+ ```
86
+
87
+ Tests run without hardware: the kinematics is checked against golden
88
+ joint-angles-to-XYZ values captured from a real arm.
@@ -0,0 +1,77 @@
1
+ # microcmm
2
+
3
+ Python library + CLI for reading positions from a MicroScribe-3D digitizer arm
4
+ over its RS-232 serial port. Speaks the Immersion HCI protocol directly (no
5
+ Windows DLL) and does the forward kinematics on the host using the arm's own
6
+ EEPROM calibration. Millimeters everywhere.
7
+
8
+ ## Install
9
+
10
+ ```
11
+ pip install microcmm
12
+ # or
13
+ uv add microcmm
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```python
19
+ from microcmm import MicroScribe
20
+
21
+ with MicroScribe("/dev/cu.usbserial-XXXX") as ms:
22
+ # You should be homing right now: arm in its home pose (stylus seated
23
+ # in the holder and vertical, counterweight against the stylus holder).
24
+ ms.home()
25
+ # (Advanced: ms.assume_homed() if the arm is already homed this power cycle.)
26
+ print(ms.info.serial_number)
27
+ p = ms.pose()
28
+ print(p.x, p.y, p.z)
29
+ ```
30
+
31
+ ## CLI
32
+
33
+ ```
34
+ microcmm <command>
35
+ ```
36
+
37
+ - `info` - identify the arm, dump its calibration constants
38
+ - `point` - read one stylus position
39
+ - `stream` - continuously print positions
40
+ - `capture -o points.csv` - capture points on keypress, write CSV
41
+ - `dist` - measure distances between captured point pairs
42
+ - `home` - set the home position (arm must be in its home pose)
43
+ - `ports` - list serial ports
44
+
45
+ ## Notes
46
+
47
+ - **Homing is mandatory.** The arm only reads correctly if it was in its home
48
+ pose (stylus seated in the holder and vertical, counterweight pressed
49
+ against the bottom of the stylus holder) at power-on or when `home` was
50
+ sent. This is lost at every power cycle. The library refuses to return
51
+ positions until you call `home()` or explicitly `assume_homed()` - an
52
+ unhomed arm produces garbage that looks plausible.
53
+ - **Only tested on a MicroScribe-3D model D (5-DOF).** The library refuses
54
+ other models by precaution, not because they can't work - if you have one,
55
+ run with `allow_untested_models=True` and report back, we'll add it.
56
+ - **Pedals are not implemented** because we don't have one. The raw button
57
+ byte is exposed on every packet if you want to try.
58
+ - 5-DOF arms have no roll about the stylus axis; the reported orientation
59
+ (XYZ-fixed roll/pitch/yaw) reflects that.
60
+ - Accuracy validated with a 45-point single-divot pivot test: 0.66 mm RMS.
61
+ Avoid poses with the stylus aligned with the forearm (singularity).
62
+ - Not implemented, on purpose: analog channels, baud switching, EEPROM
63
+ writes (SET_PARAMS / SET_HOME / RESTORE_FACTORY), motion-report streaming,
64
+ custom tip offsets (MSTIP.DAT). Ask if you need one.
65
+
66
+ ## Dev
67
+
68
+ Install dependencies with `uv sync`, then:
69
+
70
+ ```
71
+ uv run pytest
72
+ uv run ruff check src tests
73
+ uv run mypy src tests
74
+ ```
75
+
76
+ Tests run without hardware: the kinematics is checked against golden
77
+ joint-angles-to-XYZ values captured from a real arm.
@@ -0,0 +1,40 @@
1
+ [project]
2
+ name = "microcmm"
3
+ version = "0.1.0"
4
+ description = "Python library + CLI for MicroScribe-3D digitizer arms (RS-232, no Windows DLL)"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.12"
8
+ dependencies = [
9
+ "pyserial>=3.5",
10
+ ]
11
+
12
+ [project.scripts]
13
+ microcmm = "microcmm.cli:main"
14
+
15
+ [build-system]
16
+ requires = ["hatchling"]
17
+ build-backend = "hatchling.build"
18
+
19
+ [tool.hatch.build.targets.wheel]
20
+ packages = ["src/microcmm"]
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "mypy>=1.14",
25
+ "pytest>=8",
26
+ "ruff>=0.9",
27
+ ]
28
+
29
+ [tool.mypy]
30
+ strict = true
31
+
32
+ [[tool.mypy.overrides]]
33
+ module = "serial.*"
34
+ ignore_missing_imports = true
35
+
36
+ [tool.ruff]
37
+ extend-exclude = ["extras", "reference"]
38
+
39
+ [project.urls]
40
+ Repository = "https://github.com/Revise-Robotics/microcmm"
@@ -0,0 +1,17 @@
1
+ from .arm import Arm, NotHomedError, Pose, UnsupportedDeviceError
2
+ from .device import MicroScribe
3
+ from .hci import HCI, DeviceInfo, HCIError, HCITimeout, Maxes, Packet
4
+
5
+ __all__ = [
6
+ "HCI",
7
+ "Arm",
8
+ "DeviceInfo",
9
+ "HCIError",
10
+ "HCITimeout",
11
+ "Maxes",
12
+ "MicroScribe",
13
+ "NotHomedError",
14
+ "Packet",
15
+ "Pose",
16
+ "UnsupportedDeviceError",
17
+ ]