dechatter 0.1.0 → 0.2.0
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.
- package/CHANGELOG.md +103 -0
- package/README.md +281 -241
- package/THIRD_PARTY_NOTICES.md +24 -24
- package/package.json +40 -39
- package/web/dechatter.zip +0 -0
- package/web/engine.js +92 -92
- package/web/index.html +81 -81
- package/web/mic-worklet.js +34 -34
- package/web/mic.js +106 -106
- package/web/pyodide/pyodide.js +4 -4
- package/web/widget.css +95 -85
- package/web/widget.js +863 -806
- package/web/wizard.js +354 -190
package/README.md
CHANGED
|
@@ -1,241 +1,281 @@
|
|
|
1
|
-
# dechatter
|
|
2
|
-
|
|
3
|
-
dechatter finds the fastest chatter-free cut for one tool on one milling machine. It writes a
|
|
4
|
-
G-code program of test cuts, listens while the machine runs it, and decides from the sound
|
|
5
|
-
which cuts chattered. From that it either plans a finer round of cuts or reports the best
|
|
6
|
-
stable speeds and widths.
|
|
7
|
-
|
|
8
|
-
It runs as a widget inside [cncjs](https://cnc.js.org), entirely in the browser and recording
|
|
9
|
-
with that computer's microphone, or from the command line with a recording made on a phone.
|
|
10
|
-
The G-code is
|
|
11
|
-
plain Grbl dialect (`G0`, `G1`, `G4`, `M3`, `M5`), written for FluidNC and usable on Grbl and
|
|
12
|
-
grblHAL.
|
|
13
|
-
|
|
14
|
-
## What it measures
|
|
15
|
-
|
|
16
|
-
Chatter depends on the machine, the holder, the cutter and how far the cutter sticks out.
|
|
17
|
-
Machine weight, spindle power and material cannot predict it. They only bound the search:
|
|
18
|
-
the speed range, the power cap and the starting chip load. The cuts are the measurement, and
|
|
19
|
-
a result applies to that one tool assembly. Change the stickout and you start a new session.
|
|
20
|
-
|
|
21
|
-
Each round holds chip load and axial depth constant and varies spindle speed and radial width,
|
|
22
|
-
one pass per combination, cutting along the front face of a block held in the vise. Feed
|
|
23
|
-
follows speed so the chip load stays put.
|
|
24
|
-
|
|
25
|
-
### Comparing depths
|
|
26
|
-
|
|
27
|
-
A deep, narrow cut and a shallower, wider one can remove the same amount, and only cutting
|
|
28
|
-
tells which your machine prefers. List shallower depths in the wizard's Cut step (or
|
|
29
|
-
`other_depths_mm` in `setup.toml`) and the session continues with them once the deepest depth
|
|
30
|
-
is settled, deepest first. A width that was stable in a deeper cut is taken as stable in a
|
|
31
|
-
shallower one, so each further depth starts from those widths and only looks for how much
|
|
32
|
-
wider it can go. A depth is left once no cut within the power cap that would beat the best
|
|
33
|
-
one found keeps a fair chance of being stable. The results list the best cuts of all depths
|
|
34
|
-
together.
|
|
35
|
-
|
|
36
|
-
The depths run deepest first because a shallower cut leaves the face flat only above its own
|
|
37
|
-
depth. Planning a deeper cut on such a block is refused: mount fresh stock for it.
|
|
38
|
-
|
|
39
|
-
## Use in cncjs
|
|
40
|
-
|
|
41
|
-
```sh
|
|
42
|
-
npm install dechatter
|
|
43
|
-
cncjs --mount "/dechatter:$(npm root)/dechatter/web" # PowerShell or a POSIX shell
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
The npm package is the widget as a static folder, about 30 MB. To build that folder from
|
|
47
|
-
source instead:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
uv tool install git+https://github.com/pedropaulovc/dechatter
|
|
51
|
-
|
|
52
|
-
dechatter widget ~/dechatter-widget
|
|
53
|
-
cncjs --mount /dechatter:$HOME/dechatter-widget
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
In cncjs, open Manage Widgets, enable the Custom widget, and set its URL to `/dechatter/` in
|
|
57
|
-
the widget's settings. Open cncjs at `http://localhost:8000` or over HTTPS: browsers only give
|
|
58
|
-
a page the microphone on those. Then, in the widget:
|
|
59
|
-
|
|
60
|
-
1. Create a session. A short wizard asks for the machine, the tool, the cut and the stock. It
|
|
61
|
-
shows lengths in inches when the machine is in G20 and in millimetres when it is in G21,
|
|
62
|
-
or with no machine connected. Its last step holds the planner's settings, which rarely
|
|
63
|
-
need changing.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
showing
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
the
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
1
|
+
# dechatter
|
|
2
|
+
|
|
3
|
+
dechatter finds the fastest chatter-free cut for one tool on one milling machine. It writes a
|
|
4
|
+
G-code program of test cuts, listens while the machine runs it, and decides from the sound
|
|
5
|
+
which cuts chattered. From that it either plans a finer round of cuts or reports the best
|
|
6
|
+
stable speeds and widths.
|
|
7
|
+
|
|
8
|
+
It runs as a widget inside [cncjs](https://cnc.js.org), entirely in the browser and recording
|
|
9
|
+
with that computer's microphone, or from the command line with a recording made on a phone.
|
|
10
|
+
The G-code is
|
|
11
|
+
plain Grbl dialect (`G0`, `G1`, `G4`, `M3`, `M5`), written for FluidNC and usable on Grbl and
|
|
12
|
+
grblHAL.
|
|
13
|
+
|
|
14
|
+
## What it measures
|
|
15
|
+
|
|
16
|
+
Chatter depends on the machine, the holder, the cutter and how far the cutter sticks out.
|
|
17
|
+
Machine weight, spindle power and material cannot predict it. They only bound the search:
|
|
18
|
+
the speed range, the power cap and the starting chip load. The cuts are the measurement, and
|
|
19
|
+
a result applies to that one tool assembly. Change the stickout and you start a new session.
|
|
20
|
+
|
|
21
|
+
Each round holds chip load and axial depth constant and varies spindle speed and radial width,
|
|
22
|
+
one pass per combination, cutting along the front face of a block held in the vise. Feed
|
|
23
|
+
follows speed so the chip load stays put.
|
|
24
|
+
|
|
25
|
+
### Comparing depths
|
|
26
|
+
|
|
27
|
+
A deep, narrow cut and a shallower, wider one can remove the same amount, and only cutting
|
|
28
|
+
tells which your machine prefers. List shallower depths in the wizard's Cut step (or
|
|
29
|
+
`other_depths_mm` in `setup.toml`) and the session continues with them once the deepest depth
|
|
30
|
+
is settled, deepest first. A width that was stable in a deeper cut is taken as stable in a
|
|
31
|
+
shallower one, so each further depth starts from those widths and only looks for how much
|
|
32
|
+
wider it can go. A depth is left once no cut within the power cap that would beat the best
|
|
33
|
+
one found keeps a fair chance of being stable. The results list the best cuts of all depths
|
|
34
|
+
together.
|
|
35
|
+
|
|
36
|
+
The depths run deepest first because a shallower cut leaves the face flat only above its own
|
|
37
|
+
depth. Planning a deeper cut on such a block is refused: mount fresh stock for it.
|
|
38
|
+
|
|
39
|
+
## Use in cncjs
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
npm install dechatter
|
|
43
|
+
cncjs --mount "/dechatter:$(npm root)/dechatter/web" # PowerShell or a POSIX shell
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The npm package is the widget as a static folder, about 30 MB. To build that folder from
|
|
47
|
+
source instead:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
uv tool install git+https://github.com/pedropaulovc/dechatter
|
|
51
|
+
|
|
52
|
+
dechatter widget ~/dechatter-widget
|
|
53
|
+
cncjs --mount /dechatter:$HOME/dechatter-widget
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
In cncjs, open Manage Widgets, enable the Custom widget, and set its URL to `/dechatter/` in
|
|
57
|
+
the widget's settings. Open cncjs at `http://localhost:8000` or over HTTPS: browsers only give
|
|
58
|
+
a page the microphone on those. Then, in the widget:
|
|
59
|
+
|
|
60
|
+
1. Create a session. A short wizard asks for the machine, the tool, the cut and the stock. It
|
|
61
|
+
shows lengths in inches when the machine is in G20 and in millimetres when it is in G21,
|
|
62
|
+
or with no machine connected. Its last step holds the planner's settings, which rarely
|
|
63
|
+
need changing. Settings with a sensible default or a computed value (the machine's name,
|
|
64
|
+
the holder, the cut's limits and chip load, the program's dwell, clearance, plunge feed,
|
|
65
|
+
truing width and coolant, and the planner) sit in a collapsed Advanced section of their
|
|
66
|
+
step, showing what an empty entry becomes. A section holding a changed setting opens by
|
|
67
|
+
itself. Every field has an (i) button with a longer explanation: what it changes, its
|
|
68
|
+
default, and whether it may change after a cut. Saving from the wizard rewrites the
|
|
69
|
+
session's setup file without comments.
|
|
70
|
+
Programs are written in the machine's units too (G20 or G21, as cncjs reports it), so a
|
|
71
|
+
job never changes them, even one stopped part-way. Their comments, like the plan and the
|
|
72
|
+
results, stay in millimetres.
|
|
73
|
+
Nothing is planned until the wizard has been saved: a new session holds only an example
|
|
74
|
+
setup. Each round keeps a copy of the setup it was planned from. Once a round has been
|
|
75
|
+
cut, the setup can no longer change in anything that shapes the cut or its sound (the
|
|
76
|
+
machine's weight and spindle control, the tool, the work material, depth, direction and
|
|
77
|
+
chip load, the stock length, the dwell and the coolant), since the stability map belongs
|
|
78
|
+
to the setup it was measured with: start a new session instead. What only bounds the
|
|
79
|
+
search may still change (the machine's speed range and power, the cut's speed and width
|
|
80
|
+
limits and shallower depths), as may the machine's name, the safe height, clearance,
|
|
81
|
+
plunge feed, truing width, stock width and the planner's settings. Cuts outside narrowed
|
|
82
|
+
bounds stay in their round but are not recommended, nor are cuts over a lowered power
|
|
83
|
+
cap. On the map, a stable cut wider than a narrowed width limit counts as stable at the
|
|
84
|
+
widest width searched; chatter that wide, and cuts at speeds outside the limits, are left
|
|
85
|
+
out. A round
|
|
86
|
+
planned but not yet run is discarded when the setup changes its program, so the next
|
|
87
|
+
plan uses the new setup. `dechatter plan` refuses the same changes made by hand.
|
|
88
|
+
2. Plan a round. Round 1 is a coarse grid of speeds and widths.
|
|
89
|
+
3. Set the work zero at the left end of the stock, on its front face, at the top.
|
|
90
|
+
4. Load the program into cncjs and press play in cncjs. The widget never starts the machine.
|
|
91
|
+
5. Recording starts when the job starts and stops when it ends. The widget then shows each
|
|
92
|
+
pass as stable or chatter, the stability map and the best cuts so far.
|
|
93
|
+
6. If your ears disagree with a verdict, change it in the table. Plan the next round and
|
|
94
|
+
repeat until the widget reports convergence.
|
|
95
|
+
7. Optionally, plan the chip-load sweep it then offers: the best cut once more at five
|
|
96
|
+
chip loads, from 0.6 to 1.7 times the session's (both Advanced planner settings), lightest
|
|
97
|
+
first and inside the power cap. The result is the highest chip load that stayed stable,
|
|
98
|
+
with its feed. Its cuts do not change the map, which stays at the session's chip load.
|
|
99
|
+
8. Download the report: one HTML page to print (Letter or A4, black and white) and keep with
|
|
100
|
+
the tool. It holds the recommended cuts per depth with feed, removal rate and spindle
|
|
101
|
+
power, the stability map, every round's passes (marking verdicts set by hand) and the
|
|
102
|
+
setup. Lengths follow the machine's G20/G21, with mm beside. It is offered on convergence
|
|
103
|
+
and any time beside the best cuts.
|
|
104
|
+
|
|
105
|
+
Everything runs in the browser tab. The same Python that the command line uses runs there
|
|
106
|
+
under [Pyodide](https://pyodide.org), which `dechatter widget` downloads once and copies into
|
|
107
|
+
the folder, so the shop PC needs no Python and no internet. The microphone is the browser's,
|
|
108
|
+
on whichever computer shows cncjs, opened with echo cancellation, noise suppression and
|
|
109
|
+
automatic gain switched off. The widget shows its level before any cutting and warns if the
|
|
110
|
+
browser kept any of that processing on.
|
|
111
|
+
|
|
112
|
+
Sessions are stored in that browser (IndexedDB), per cncjs address. Export saves one as a zip
|
|
113
|
+
holding `setup.toml` and each round's plan, program, `recording.wav`, results and the job
|
|
114
|
+
timeline cncjs reported, plus `report.html`. Import loads it in another browser, and unzipped it is a session
|
|
115
|
+
folder the command line reads. Keep the tab open while a round runs: the recording lives in
|
|
116
|
+
the page until the job ends.
|
|
117
|
+
|
|
118
|
+
### Manual spindle
|
|
119
|
+
|
|
120
|
+
If the spindle is started and set by hand, choose "me, by hand" on the wizard's first step
|
|
121
|
+
(`spindle = "manual"` under `[machine]` in a setup file). The program then never commands the
|
|
122
|
+
spindle. It stops with `M0` before each speed, with
|
|
123
|
+
the cutter clear of the work, and the widget (and cncjs) shows the speed to set. Set it and
|
|
124
|
+
press resume in cncjs. Cuts are grouped by speed, lightest first, so a round has one stop per
|
|
125
|
+
speed: five in round 1. The first stop is where you start the spindle, and you stop it yourself
|
|
126
|
+
after the program ends.
|
|
127
|
+
|
|
128
|
+
Set the speed within 5% of what is asked; the detector finds the actual speed inside that
|
|
129
|
+
range. The stability map is built on the requested speeds, so a dial that reads off by a
|
|
130
|
+
constant amount shifts the whole map by that amount.
|
|
131
|
+
|
|
132
|
+
## Use from the command line
|
|
133
|
+
|
|
134
|
+
Without cncjs, record on a phone and run the same session by hand:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
dechatter plan al-10mm # writes al-10mm/round-01/program.nc
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Set the work zero at the left end of the stock, on its front face, at the top. Start one
|
|
141
|
+
continuous recording, run the program, stop recording after `M30`. Then:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
dechatter analyze al-10mm recording.wav # classifies each pass
|
|
145
|
+
dechatter plan al-10mm # next round, or "converged"
|
|
146
|
+
dechatter plan al-10mm --sweep # once converged: chip-load sweep of the best cut
|
|
147
|
+
dechatter report al-10mm # stability map and best cuts so far
|
|
148
|
+
dechatter report al-10mm --html al-10mm.html --units in # printable report
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Repeat until `plan` reports convergence. WAV, FLAC, OGG and MP3 load directly. Phone formats
|
|
152
|
+
such as M4A need `ffmpeg` on the path.
|
|
153
|
+
|
|
154
|
+
Round 1 is a coarse grid of speeds and widths. Later rounds are chosen from what was measured.
|
|
155
|
+
Every program orders its passes from the narrowest cut to the widest, starts with a light
|
|
156
|
+
truing pass, and tells you where the front face will end up.
|
|
157
|
+
|
|
158
|
+
## Safety
|
|
159
|
+
|
|
160
|
+
The program looks for chatter on purpose, so later passes are heavier than earlier ones and
|
|
161
|
+
some of them will chatter. Feed-hold and abort when a cut gets violent. Analyze the recording
|
|
162
|
+
anyway: the passes that ran still count, the aborted one is marked as such, and the next
|
|
163
|
+
round starts by clearing the step it left on the face.
|
|
164
|
+
|
|
165
|
+
Every planned cut stays under a power cap (60% of rated spindle power by default) and inside
|
|
166
|
+
the material's surface-speed limit. The built-in cutting data (`dechatter materials`) is a
|
|
167
|
+
conservative starting point. Override `chip_load_mm` and the speed range when you know better.
|
|
168
|
+
|
|
169
|
+
## How a pass is classified
|
|
170
|
+
|
|
171
|
+
Forced vibration sits on harmonics of the spindle rotation. Chatter is a strong tone anywhere
|
|
172
|
+
else. For each pass dechatter estimates the true spindle speed from the tooth-passing
|
|
173
|
+
harmonics, removes every spindle harmonic from the spectrum, and takes the strongest peak
|
|
174
|
+
left over. The pass is unstable when that peak is at least 27 dB above the median of the
|
|
175
|
+
remaining spectrum and at least 10 dB above the same frequency in the dwell just before the
|
|
176
|
+
pass, when the spindle was turning in air. The second test rejects tones the machine makes
|
|
177
|
+
without cutting, such as drive whine.
|
|
178
|
+
|
|
179
|
+
Passes are found in the recording by level, then matched in order to the planned passes by
|
|
180
|
+
how long each cut should last. A quiet pass that goes undetected is reported as missing and
|
|
181
|
+
does not shift the others. If matching fails, mark the cuts yourself and pass
|
|
182
|
+
`--segments labels.txt` (start and end seconds per pass; an Audacity label export works).
|
|
183
|
+
|
|
184
|
+
`results.json` in each round holds the verdicts and the numbers behind them. If your ears
|
|
185
|
+
disagree with a verdict, change it in the widget or edit it there before planning the next
|
|
186
|
+
round.
|
|
187
|
+
|
|
188
|
+
### How well it works
|
|
189
|
+
|
|
190
|
+
`validation/purdue.py` scores the detector against the
|
|
191
|
+
[Purdue CNC cutting sound dataset](https://github.com/purduelamm/mt_cutting_dataset): 583 cuts
|
|
192
|
+
in steel and aluminium on a Hurco VM20i, each labelled by two operators.
|
|
193
|
+
|
|
194
|
+
| Operators say | Cuts | Detector agrees |
|
|
195
|
+
|---|---|---|
|
|
196
|
+
| chatter (both) | 169 | 142 (84%) |
|
|
197
|
+
| no chatter (both) | 254 | 233 (92%) |
|
|
198
|
+
| slight, or they disagree | 160 | not scored |
|
|
199
|
+
|
|
200
|
+
The 27 dB threshold was chosen on this same data, so these numbers are a fit and the detector
|
|
201
|
+
has not been scored on a second dataset. Most of those cuts last about a second; dechatter's
|
|
202
|
+
own passes are longer, which gives a finer spectrum. Removing the spindle harmonics matters:
|
|
203
|
+
without that step the best achievable balanced accuracy on this data falls from 88% to 75%.
|
|
204
|
+
|
|
205
|
+
It has not yet been run on a real machine end to end. The planner and the audio pipeline are
|
|
206
|
+
tested against a simulated machine with stability lobes (`tests/synth.py`), where a session
|
|
207
|
+
converges in about three rounds and 27 cuts to within 10% of the true best removal rate. The
|
|
208
|
+
widget was driven through that same session in Chrome against cncjs 1.11.5 and a simulated
|
|
209
|
+
Grbl (`e2e/`), with the simulated machine's sound played into the widget in place of the
|
|
210
|
+
microphone. Capture from a real webcam microphone was checked separately, without cutting.
|
|
211
|
+
|
|
212
|
+
Known limits:
|
|
213
|
+
|
|
214
|
+
- A chatter tone that lands within a few hertz of a spindle harmonic is hidden. Its sidebands
|
|
215
|
+
usually still trip the detector, but the reported frequency is then off by the tooth-passing
|
|
216
|
+
frequency. This is likeliest at low speed, where the harmonics are close together.
|
|
217
|
+
- Flood coolant and a noisy shop raise the noise floor. Record close to the spindle.
|
|
218
|
+
- Variable-pitch cutters break the assumption that tooth passing is one frequency.
|
|
219
|
+
|
|
220
|
+
## How the next round is chosen
|
|
221
|
+
|
|
222
|
+
The planner follows Karandikar et al., "Evaluation of automated stability testing in machining
|
|
223
|
+
through closed-loop control and Bayesian machine learning"
|
|
224
|
+
([MSSP 181, 2022](https://doi.org/10.1016/j.ymssp.2022.109531)). It keeps a probability of
|
|
225
|
+
stability over the speed and width grid, starting from "wider is less likely to be stable".
|
|
226
|
+
A stable cut raises the probability of everything narrower near that speed, and an unstable
|
|
227
|
+
cut lowers everything wider. The next cuts are the ones with the highest expected improvement
|
|
228
|
+
in removal rate, and the session has converged when no cut promises 5% more.
|
|
229
|
+
|
|
230
|
+
Three things differ from the paper, which tests one cut at a time under closed-loop control:
|
|
231
|
+
|
|
232
|
+
- A round is a batch with no feedback between cuts. Later cuts in a batch assume the earlier
|
|
233
|
+
ones pass, so widths can ramp at one speed, but each must also be at least 50% likely to be
|
|
234
|
+
stable on measured data alone. A cut that builds on no earlier cut in the batch must be at
|
|
235
|
+
least 80% likely.
|
|
236
|
+
- The paper does not give its likelihood. Here each speed has a distribution over its
|
|
237
|
+
stability limit, each verdict is assumed wrong 5% of the time, and evidence fades with
|
|
238
|
+
distance in speed (1.5% of the speed, one standard deviation).
|
|
239
|
+
- Chatter frequency is used. A chatter tone at `f` Hz predicts stable pockets where tooth
|
|
240
|
+
passing divides it, at `60 f / (flutes k)` rpm. Those speeds get partial credit for the
|
|
241
|
+
width that was stable where the chatter was heard, so the planner tries them.
|
|
242
|
+
|
|
243
|
+
The stock runs out before the search does on small blocks. `plan` then asks for fresh stock;
|
|
244
|
+
mount it, reset the face to `Y0` and run `dechatter plan --new-stock`.
|
|
245
|
+
|
|
246
|
+
## Development
|
|
247
|
+
|
|
248
|
+
```sh
|
|
249
|
+
uv sync
|
|
250
|
+
uv run pytest
|
|
251
|
+
uv run ruff check .
|
|
252
|
+
uv run validation/purdue.py ~/purdue-cache # downloads about 370 MB once
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`e2e/` runs real cncjs against a simulated Grbl inside WSL, for driving the widget without a
|
|
256
|
+
machine. See `e2e/README.md`.
|
|
257
|
+
|
|
258
|
+
Every change users can notice adds a line under `## [Unreleased]` in
|
|
259
|
+
[`CHANGELOG.md`](CHANGELOG.md), in the same pull request: what they will notice and, for a
|
|
260
|
+
breaking change, what to do about it.
|
|
261
|
+
|
|
262
|
+
To release, set the same version in `src/dechatter/__init__.py` (`__version__`, which
|
|
263
|
+
`pyproject.toml` reads) and `package.json`, rename `## [Unreleased]` in `CHANGELOG.md` to
|
|
264
|
+
`## [X.Y.Z] - YYYY-MM-DD` above a fresh empty Unreleased section (and update the links at
|
|
265
|
+
its end), merge to `main`, and push a tag `vX.Y.Z` on that commit. The `release` workflow
|
|
266
|
+
refuses a tag without that dated section, tests on Linux and Windows, builds the widget
|
|
267
|
+
once, publishes that build to npm, and creates the GitHub release with the section as its
|
|
268
|
+
notes. npm trusts the workflow itself, so no token
|
|
269
|
+
is stored; version 0.1.0 was published by hand, because that trust can only be registered
|
|
270
|
+
for a package that exists.
|
|
271
|
+
|
|
272
|
+
## Related work
|
|
273
|
+
|
|
274
|
+
[Harmonizer](https://taptest.co/harmonizer) and
|
|
275
|
+
[ChatterPro Mobile](https://www.malinc.com/products/chatterpro-mobile/) are commercial phone
|
|
276
|
+
apps that recommend a speed from the sound of a cut. The test method, constant chip load with
|
|
277
|
+
stepped speed and width, is described in CNCCookbook's
|
|
278
|
+
[chatter article](https://www.cnccookbook.com/chatter-in-machining-milling-lathe-vibration/).
|
|
279
|
+
|
|
280
|
+
MIT licensed. The npm package also carries Pyodide, CPython, NumPy and SciPy under their own
|
|
281
|
+
licences; see `THIRD_PARTY_NOTICES.md`.
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# Third-party software in the npm package
|
|
2
|
-
|
|
3
|
-
dechatter's own code is MIT licensed (see `LICENSE`). The npm package also redistributes the
|
|
4
|
-
software below in `web/pyodide/`, so that the widget runs in a browser tab without a server.
|
|
5
|
-
The exact versions are the ones pinned in `src/dechatter/export.py` and listed in
|
|
6
|
-
`web/pyodide/pyodide-lock.json`.
|
|
7
|
-
|
|
8
|
-
| Files | Software | Licence | Source |
|
|
9
|
-
| --- | --- | --- | --- |
|
|
10
|
-
| `pyodide.js`, `pyodide.asm.js`, `pyodide.asm.wasm`, `pyodide-lock.json` | Pyodide | MPL-2.0 | https://github.com/pyodide/pyodide |
|
|
11
|
-
| `python_stdlib.zip`, and the interpreter inside `pyodide.asm.wasm` | CPython | PSF-2.0 | https://github.com/python/cpython |
|
|
12
|
-
| `numpy-*.whl` | NumPy | BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0, as the wheel declares | https://github.com/numpy/numpy |
|
|
13
|
-
| `scipy-*.whl` | SciPy | BSD-3-Clause, with bundled components under their own licences | https://github.com/scipy/scipy |
|
|
14
|
-
|
|
15
|
-
Two of the files are renamed copies: `pyodide.js` and `pyodide.asm.js` are Pyodide's
|
|
16
|
-
`pyodide.mjs` and `pyodide.asm.mjs`, and the one reference between them is renamed to match,
|
|
17
|
-
because cncjs serves `.mjs` files with a type browsers refuse to run. Nothing else is changed.
|
|
18
|
-
|
|
19
|
-
The Pyodide runtime also contains the libraries it is built with; their licence texts are in
|
|
20
|
-
the Pyodide repository. Each wheel is a zip archive and carries the licence texts of its
|
|
21
|
-
project and of what it bundles: in `*.dist-info/` and beside the bundled components.
|
|
22
|
-
|
|
23
|
-
The source code for the Pyodide files, which the MPL-2.0 asks to be made available, is at the
|
|
24
|
-
repository above under the tag of the pinned version.
|
|
1
|
+
# Third-party software in the npm package
|
|
2
|
+
|
|
3
|
+
dechatter's own code is MIT licensed (see `LICENSE`). The npm package also redistributes the
|
|
4
|
+
software below in `web/pyodide/`, so that the widget runs in a browser tab without a server.
|
|
5
|
+
The exact versions are the ones pinned in `src/dechatter/export.py` and listed in
|
|
6
|
+
`web/pyodide/pyodide-lock.json`.
|
|
7
|
+
|
|
8
|
+
| Files | Software | Licence | Source |
|
|
9
|
+
| --- | --- | --- | --- |
|
|
10
|
+
| `pyodide.js`, `pyodide.asm.js`, `pyodide.asm.wasm`, `pyodide-lock.json` | Pyodide | MPL-2.0 | https://github.com/pyodide/pyodide |
|
|
11
|
+
| `python_stdlib.zip`, and the interpreter inside `pyodide.asm.wasm` | CPython | PSF-2.0 | https://github.com/python/cpython |
|
|
12
|
+
| `numpy-*.whl` | NumPy | BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0, as the wheel declares | https://github.com/numpy/numpy |
|
|
13
|
+
| `scipy-*.whl` | SciPy | BSD-3-Clause, with bundled components under their own licences | https://github.com/scipy/scipy |
|
|
14
|
+
|
|
15
|
+
Two of the files are renamed copies: `pyodide.js` and `pyodide.asm.js` are Pyodide's
|
|
16
|
+
`pyodide.mjs` and `pyodide.asm.mjs`, and the one reference between them is renamed to match,
|
|
17
|
+
because cncjs serves `.mjs` files with a type browsers refuse to run. Nothing else is changed.
|
|
18
|
+
|
|
19
|
+
The Pyodide runtime also contains the libraries it is built with; their licence texts are in
|
|
20
|
+
the Pyodide repository. Each wheel is a zip archive and carries the licence texts of its
|
|
21
|
+
project and of what it bundles: in `*.dist-info/` and beside the bundled components.
|
|
22
|
+
|
|
23
|
+
The source code for the Pyodide files, which the MPL-2.0 asks to be made available, is at the
|
|
24
|
+
repository above under the tag of the pinned version.
|