]> pere.pagekite.me Git - homepage.git/blob - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom="http://www.w3.org/2005/Atom">
3 <channel>
4 <title>Petter Reinholdtsen</title>
5 <description></description>
6 <link>https://people.skolelinux.org/pere/blog/</link>
7 <atom:link href="https://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
8
9 <item>
10 <title>Speech to text, she APTly whispered, how hard can it be?</title>
11 <link>https://people.skolelinux.org/pere/blog/Speech_to_text__she_APTly_whispered__how_hard_can_it_be_.html</link>
12 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Speech_to_text__she_APTly_whispered__how_hard_can_it_be_.html</guid>
13 <pubDate>Sun, 23 Apr 2023 09:40:00 +0200</pubDate>
14 <description>&lt;p&gt;While visiting a convention during Eastern, it occurred to me that
15 it would be great if I could have a digital Dictaphone with
16 transcribing capabilities, providing me with texts to cut-n-paste into
17 stuff I need to write. The background is that long drives often bring
18 up the urge to write on texts I am working on, which of course is out
19 of the question while driving. With the release of
20 &lt;a href=&quot;https://github.com/openai/whisper/&quot;&gt;OpenAI Whisper&lt;/a&gt;, this
21 seem to be within reach with Free Software, so I decided to give it a
22 go. OpenAI Whisper is a Linux based neural network system to read in
23 audio files and provide text representation of the speech in that
24 audio recording. It handle multiple languages and according to its
25 creators even can translate into a different language than the spoken
26 one. I have not tested the latter feature. It can either use the CPU
27 or a GPU with CODA support. As far as I can tell, CODA in practice
28 limit that feature to NVidia graphics cards. I have few of those, as
29 they do not work great with free software drivers, and have not tested
30 the GPU option. While looking into the matter, I did discover some
31 work to provide CODA support on non-NVidia GPUs, and some work with
32 the library used by Whisper to port it to other GPUs, but have not
33 spent much time looking into GPU support yet. I&#39;ve so far used an old
34 X220 laptop as my test machine, and only transcribed using its
35 CPU.&lt;/p&gt;
36
37 &lt;p&gt;As it from a privacy standpoint is unthinkable to use computers
38 under control of someone else (aka a &quot;cloud&quot; service) to transcribe
39 ones thoughts and personal notes, I want to run the transcribing
40 system locally on my own computers. The only sensible approach to me
41 is to make the effort I put into this available for any Linux user and
42 to upload the needed packages into Debian. Looking at Debian Bookworm, I
43 discovered that only three packages were missing,
44 &lt;a href=&quot;https://bugs.debian.org/1034307&quot;&gt;tiktoken&lt;/a&gt;,
45 &lt;a href=&quot;https://bugs.debian.org/1034144&quot;&gt;triton&lt;/a&gt;, and
46 &lt;a href=&quot;https://bugs.debian.org/1034091&quot;&gt;openai-whisper&lt;/a&gt;. For a while
47 I also believed
48 &lt;a href=&quot;https://bugs.debian.org/1034286&quot;&gt;ffmpeg-python&lt;/a&gt; was
49 needed, but as its
50 &lt;a href=&quot;https://github.com/kkroening/ffmpeg-python/issues/760&quot;&gt;upstream
51 seem to have vanished&lt;/a&gt; I found it safer
52 &lt;a href=&quot;https://github.com/openai/whisper/pull/1242&quot;&gt;to rewrite
53 whisper&lt;/a&gt; to stop depending on in than to introduce ffmpeg-python
54 into Debian. I decided to place these packages under the umbrella of
55 &lt;a href=&quot;https://salsa.debian.org/deeplearning-team&quot;&gt;the Debian Deep
56 Learning Team&lt;/a&gt;, which seem like the best team to look after such
57 packages. Discussing the topic within the group also made me aware
58 that the triton package was already a future dependency of newer
59 versions of the torch package being planned, and would be needed after
60 Bookworm is released.&lt;/p&gt;
61
62 &lt;p&gt;All required code packages have been now waiting in
63 &lt;a href=&quot;https://ftp-master.debian.org/new.html&quot;&gt;the Debian NEW
64 queue&lt;/a&gt; since Wednesday, heading for Debian Experimental until
65 Bookworm is released. An unsolved issue is how to handle the neural
66 network models used by Whisper. The default behaviour of Whisper is
67 to require Internet connectivity and download the model requested to
68 &lt;tt&gt;~/.cache/whisper/&lt;/tt&gt; on first invocation. This obviously would
69 fail &lt;a href=&quot;https://people.debian.org/~bap/dfsg-faq.html&quot;&gt;the
70 deserted island test of free software&lt;/a&gt; as the Debian packages would
71 be unusable for someone stranded with only the Debian archive and solar
72 powered computer on a deserted island.&lt;/p&gt;
73
74 &lt;p&gt;Because of this, I would love to include the models in the Debian
75 mirror system. This is problematic, as the models are very large
76 files, which would put a heavy strain on the Debian mirror
77 infrastructure around the globe. The strain would be even higher if
78 the models change often, which luckily as far as I can tell they do
79 not. The small model, which according to its creator is most useful
80 for English and in my experience is not doing a great job there
81 either, is 462 MiB (deb is 414 MiB). The medium model, which to me
82 seem to handle English speech fairly well is 1.5 GiB (deb is 1.3 GiB)
83 and the large model is 2.9 GiB (deb is 2.6 GiB). I would assume
84 everyone with enough resources would prefer to use the large model for
85 highest quality. I believe the models themselves would have to go
86 into the non-free part of the Debian archive, as they are not really
87 including any useful source code for updating the models. The
88 &quot;source&quot;, aka the model training set, according to the creators
89 consist of &quot;680,000 hours of multilingual and multitask supervised
90 data collected from the web&quot;, which to me reads material with both
91 unknown copyright terms, unavailable to the general public. In other
92 words, the source is not available according to the Debian Free
93 Software Guidelines and the model should be considered non-free.&lt;/p&gt;
94
95 &lt;p&gt;I asked the Debian FTP masters for advice regarding uploading a
96 model package on their IRC channel, and based on the feedback there it
97 is still unclear to me if such package would be accepted into the
98 archive. In any case I wrote build rules for a
99 &lt;a href=&quot;https://salsa.debian.org/deeplearning-team/openai-whisper-model&quot;&gt;OpenAI
100 Whisper model package&lt;/a&gt; and
101 &lt;a href=&quot;https://github.com/openai/whisper/pull/1257&quot;&gt;modified the
102 Whisper code base&lt;/a&gt; to prefer shared files under &lt;tt&gt;/usr/&lt;/tt&gt; and
103 &lt;tt&gt;/var/&lt;/tt&gt; over user specific files in &lt;tt&gt;~/.cache/whisper/&lt;/tt&gt;
104 to be able to use these model packages, to prepare for such
105 possibility. One solution might be to include only one of the models
106 (small or medium, I guess) in the Debian archive, and ask people to
107 download the others from the Internet. Not quite sure what to do
108 here, and advice is most welcome (use the debian-ai mailing list).&lt;/p&gt;
109
110 &lt;p&gt;To make it easier to test the new packages while I wait for them to
111 clear the NEW queue, I created an APT source targeting bookworm. I
112 selected Bookworm instead of Bullseye, even though I know the latter
113 would reach more users, is that some of the required dependencies are
114 missing from Bullseye and I during this phase of testing did not want
115 to backport a lot of packages just to get up and running.&lt;/p&gt;
116
117 &lt;p&gt;Here is a recipe to run as user root if you want to test OpenAI
118 Whisper using Debian packages on your Debian Bookworm installation,
119 first adding the APT repository GPG key to the list of trusted keys,
120 then setting up the APT repository and finally installing the packages
121 and one of the models:&lt;/p&gt;
122
123 &lt;p&gt;&lt;pre&gt;
124 curl https://geekbay.nuug.no/~pere/openai-whisper/D78F5C4796F353D211B119E28200D9B589641240.asc \
125 -o /etc/apt/trusted.gpg.d/pere-whisper.asc
126 mkdir -p /etc/apt/sources.list.d
127 cat &gt; /etc/apt/sources.list.d/pere-whisper.list &amp;lt;&amp;lt;EOF
128 deb https://geekbay.nuug.no/~pere/openai-whisper/ bookworm main
129 deb-src https://geekbay.nuug.no/~pere/openai-whisper/ bookworm main
130 EOF
131 apt update
132 apt install openai-whisper
133 &lt;/pre&gt;&lt;/p&gt;
134
135 &lt;p&gt;The package work for me, but have not yet been tested on any other
136 computer than my own. With it, I have been able to (badly) transcribe
137 a 2 minute 40 second Norwegian audio clip to test using the small
138 model. This took 11 minutes and around 2.2 GiB of RAM. Transcribing
139 the same file with the medium model gave a accurate text in 77 minutes
140 using around 5.2 GiB of RAM. My test machine had too little memory to
141 test the large model, which I believe require 11 GiB of RAM. In
142 short, this now work for me using Debian packages, and I hope it will
143 for you and everyone else once the packages enter Debian.&lt;/p&gt;
144
145 &lt;p&gt;Now I can start on the audio recording part of this project.&lt;/p&gt;
146
147 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
148 activities, please send Bitcoin donations to my address
149 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
150 </description>
151 </item>
152
153 <item>
154 <title>rtlsdr-scanner, software defined radio frequency scanner for Linux - nice free software</title>
155 <link>https://people.skolelinux.org/pere/blog/rtlsdr_scanner__software_defined_radio_frequency_scanner_for_Linux____nice_free_software.html</link>
156 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/rtlsdr_scanner__software_defined_radio_frequency_scanner_for_Linux____nice_free_software.html</guid>
157 <pubDate>Fri, 7 Apr 2023 23:10:00 +0200</pubDate>
158 <description>&lt;p&gt;Today I finally found time to track down a useful radio frequency
159 scanner for my software defined radio. Just for fun I tried to locate
160 the radios used in the areas, and a good start would be to scan all
161 the frequencies to see what is in use. I&#39;ve tried to find a useful
162 program earlier, but ran out of time before I managed to find a useful
163 tool. This time I was more successful, and after a few false leads I
164 found a description of
165 &lt;a href=&quot;https://www.kali.org/tools/rtlsdr-scanner/&quot;&gt;rtlsdr-scanner
166 over at the Kali site&lt;/a&gt;, and was able to track down
167 &lt;a href=&quot;https://gitlab.com/kalilinux/packages/rtlsdr-scanner.git&quot;&gt;the
168 Kali package git repository&lt;/a&gt; to build a deb package for the
169 scanner. Sadly the package is missing from the Debian project itself,
170 at least in Debian Bullseye. Two runtime dependencies,
171 &lt;a href=&quot;https://gitlab.com/kalilinux/packages/python-visvis.git&quot;&gt;python-visvis&lt;/a&gt;
172 and
173 &lt;a href=&quot;https://gitlab.com/kalilinux/packages/python-rtlsdr.git&quot;&gt;python-rtlsdr&lt;/a&gt;
174 had to be built and installed separately. Luckily &#39;&lt;tt&gt;gbp
175 buildpackage&lt;/tt&gt;&#39; handled them just fine and no further packages had
176 to be manually built. The end result worked out of the box after
177 installation.&lt;/p&gt;
178
179 &lt;p&gt;My initial scans for FM channels worked just fine, so I knew the
180 scanner was functioning. But when I tried to scan every frequency
181 from 100 to 1000 MHz, the program stopped unexpectedly near the
182 completion. After some debugging I discovered USB software radio I
183 used rejected frequencies above 948 MHz, triggering a unreported
184 exception breaking the scan. Changing the scan to end at 957 worked
185 better. I similarly found the lower limit to be around 15, and ended
186 up with the following full scan:&lt;/p&gt;
187
188 &lt;p&gt;&lt;a href=&quot;https://people.skolelinux.org/pere/blog/images/2023-04-07-radio-freq-scanning.png&quot;&gt;&lt;img src=&quot;https://people.skolelinux.org/pere/blog/images/2023-04-07-radio-freq-scanning.png&quot; width=&quot;100%&quot;&gt;&lt;/a&gt;&lt;/p&gt;
189
190 &lt;p&gt;Saving the scan did not work, but exporting it as a CSV file worked
191 just fine. I ended up with around 477k CVS lines with dB level for
192 the given frequency.&lt;/p&gt;
193
194 &lt;p&gt;The save failure seem to be a missing UTF-8 encoding issue in the
195 python code. Will see if I can find time to send a patch
196 &lt;a href=&quot;https://github.com/CdeMills/RTLSDR-Scanner/&quot;&gt;upstream&lt;/a&gt;
197 later to fix this exception:&lt;/p&gt;
198
199 &lt;pre&gt;
200 Traceback (most recent call last):
201 File &quot;/usr/lib/python3/dist-packages/rtlsdr_scanner/main_window.py&quot;, line 485, in __on_save
202 save_plot(fullName, self.scanInfo, self.spectrum, self.locations)
203 File &quot;/usr/lib/python3/dist-packages/rtlsdr_scanner/file.py&quot;, line 408, in save_plot
204 handle.write(json.dumps(data, indent=4))
205 TypeError: a bytes-like object is required, not &#39;str&#39;
206 Traceback (most recent call last):
207 File &quot;/usr/lib/python3/dist-packages/rtlsdr_scanner/main_window.py&quot;, line 485, in __on_save
208 save_plot(fullName, self.scanInfo, self.spectrum, self.locations)
209 File &quot;/usr/lib/python3/dist-packages/rtlsdr_scanner/file.py&quot;, line 408, in save_plot
210 handle.write(json.dumps(data, indent=4))
211 TypeError: a bytes-like object is required, not &#39;str&#39;
212 &lt;/pre&gt;
213
214 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
215 activities, please send Bitcoin donations to my address
216 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
217 </description>
218 </item>
219
220 <item>
221 <title>OpenSnitch available in Debian Sid and Bookworm</title>
222 <link>https://people.skolelinux.org/pere/blog/OpenSnitch_available_in_Debian_Sid_and_Bookworm.html</link>
223 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/OpenSnitch_available_in_Debian_Sid_and_Bookworm.html</guid>
224 <pubDate>Sat, 25 Feb 2023 20:30:00 +0100</pubDate>
225 <description>&lt;p&gt;Thanks to the efforts of the OpenSnitch lead developer Gustavo
226 Iñiguez Goya allowing me to sponsor the upload,
227 &lt;a href=&quot;https://tracker.debian.org/pkg/opensnitch&quot;&gt;the interactive
228 application firewall OpenSnitch&lt;/a&gt; is now available in Debian
229 Testing, soon to become the next stable release of Debian.&lt;/p&gt;
230
231 &lt;p&gt;This is a package which set up a network firewall on one or more
232 machines, which is controlled by a graphical user interface that will
233 ask the user if a program should be allowed to connect to the local
234 network or the Internet. If some background daemon is trying to dial
235 home, it can be blocked from doing so with a simple mouse click, or by
236 default simply by not doing anything when the GUI question dialog pop
237 up. A list of all programs discovered using the network is provided
238 in the GUI, giving the user an overview of how the machine(s) programs
239 use the network.&lt;/p&gt;
240
241 &lt;p&gt;OpenSnitch was uploaded for NEW processing about a month ago, and I
242 had little hope of it getting accepted and shaping up in time for the
243 package freeze, but the Debian ftpmasters proved to be amazingly quick
244 at checking out the package and it was accepted into the archive about
245 week after the first upload. It is now team maintained under the Go
246 language team umbrella. A few fixes to the default setup is only in
247 Sid, and should migrate to Testing/Bookworm in a week.&lt;/p&gt;
248
249 &lt;p&gt;During testing I ran into an
250 &lt;a href=&quot;https://github.com/evilsocket/opensnitch/issues/813&quot;&gt;issue
251 with Minecraft server broadcasts disappearing&lt;/a&gt;, which was quickly
252 resolved by the developer with a patch and a proposed configuration
253 change. I&#39;ve been told this was caused by the Debian packages default
254 use if /proc/ information to track down kernel status, instead of the
255 newer eBPF module that can be used. The reason is simply that
256 upstream and I have failed to find a way to build the eBPF modules for
257 OpenSnitch without a complete configured Linux kernel source tree,
258 which as far as we can tell is unavailable as a build dependency in
259 Debian. We tried unsuccessfully so far to use the kernel-headers
260 package. It would be great if someone could provide some clues how to
261 build eBPF modules on build daemons in Debian, possibly without the full
262 kernel source.&lt;/p&gt;
263
264 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
265 activities, please send Bitcoin donations to my address
266 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
267 </description>
268 </item>
269
270 <item>
271 <title>Is the desktop recommending your program for opening its files?</title>
272 <link>https://people.skolelinux.org/pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html</link>
273 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html</guid>
274 <pubDate>Sun, 29 Jan 2023 11:00:00 +0100</pubDate>
275 <description>&lt;p&gt;Linux desktop systems
276 &lt;a href=&quot;https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html&quot;&gt;have
277 standardized&lt;/a&gt; how programs present themselves to the desktop
278 system. If a package include a .desktop file in
279 /usr/share/applications/, Gnome, KDE, LXDE, Xfce and the other desktop
280 environments will pick up the file and use its content to generate the
281 menu of available programs in the system. A lesser known fact is that
282 a package can also explain to the desktop system how to recognize the
283 files created by the program in question, and use it to open these
284 files on request, for example via a GUI file browser.&lt;/p&gt;
285
286 &lt;p&gt;A while back I ran into a package that did not tell the desktop
287 system how to recognize its files and was not used to open its files
288 in the file browser and fixed it. In the process I wrote a simple
289 debian/tests/ script to ensure the setup keep working. It might be
290 useful for other packages too, to ensure any future version of the
291 package keep handling its own files.&lt;/p&gt;
292
293 &lt;p&gt;For this to work the file format need a useful MIME type that can
294 be used to identify the format. If the file format do not yet have a
295 MIME type, it should define one and preferably also
296 &lt;a href=&quot;https://www.iana.org/assignments/media-types/media-types.xhtml&quot;&gt;register
297 it with IANA&lt;/a&gt; to ensure the MIME type string is reserved.&lt;/p&gt;
298
299 &lt;p&gt;The script uses the &lt;tt&gt;xdg-mime&lt;/tt&gt; program from xdg-utils to
300 query the database of standardized package information and ensure it
301 return sensible values. It also need the location of an example file
302 for xdg-mime to guess the format of.&lt;/p&gt;
303
304 &lt;pre&gt;
305 #!/bin/sh
306 #
307 # Author: Petter Reinholdtsen
308 # License: GPL v2 or later at your choice.
309 #
310 # Validate the MIME setup, making sure motor types have
311 # application/vnd.openmotor+yaml associated with them and is connected
312 # to the openmotor desktop file.
313
314 retval=0
315
316 mimetype=&quot;application/vnd.openmotor+yaml&quot;
317 testfile=&quot;test/data/real/o3100/motor.ric&quot;
318 mydesktopfile=&quot;openmotor.desktop&quot;
319
320 filemime=&quot;$(xdg-mime query filetype &quot;$testfile&quot;)&quot;
321
322 if [ &quot;$mimetype&quot; != &quot;$filemime&quot; ] ; then
323 retval=1
324 echo &quot;error: xdg-mime claim motor file MIME type is $filemine, not $mimetype&quot;
325 else
326 echo &quot;success: xdg-mime report correct mime type $mimetype for motor file&quot;
327 fi
328
329 desktop=$(xdg-mime query default &quot;$mimetype&quot;)
330
331 if [ &quot;$mydesktopfile&quot; != &quot;$desktop&quot; ]; then
332 retval=1
333 echo &quot;error: xdg-mime claim motor file should be handled by $desktop, not $mydesktopfile&quot;
334 else
335 echo &quot;success: xdg-mime agree motor file should be handled by $mydesktopfile&quot;
336 fi
337
338 exit $retval
339 &lt;/pre&gt;
340
341 &lt;p&gt;It is a simple way to ensure your users are not very surprised when
342 they try to open one of your file formats in their file browser.&lt;/p&gt;
343
344 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
345 activities, please send Bitcoin donations to my address
346 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
347 </description>
348 </item>
349
350 <item>
351 <title>Opensnitch, the application level interactive firewall, heading into the Debian archive</title>
352 <link>https://people.skolelinux.org/pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html</link>
353 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html</guid>
354 <pubDate>Sun, 22 Jan 2023 23:55:00 +0100</pubDate>
355 <description>&lt;p&gt;While reading a
356 &lt;a href=&quot;https://sneak.berlin/20230115/macos-scans-your-local-files-now/&quot;&gt;blog
357 post claiming MacOS X recently started scanning local files and
358 reporting information about them to Apple&lt;/a&gt;, even on a machine where
359 all such callback features had been disabled, I came across a
360 description of the Little Snitch application for MacOS X. It seemed
361 like a very nice tool to have in the tool box, and I decided to see if
362 something similar was available for Linux.&lt;/p&gt;
363
364 &lt;p&gt;It did not take long to find
365 &lt;a href=&quot;https://github.com/evilsocket/opensnitch&quot;&gt;the OpenSnitch
366 package&lt;/a&gt;, which has been in development since 2017, and now is in
367 version 1.5.0. It has had a
368 &lt;a href=&quot;https://bugs.debian.org/909567&quot;&gt;request for Debian
369 packaging&lt;/a&gt; since 2018, but no-one completed the job so far. Just
370 for fun, I decided to see if I could help, and I was very happy to
371 discover that
372 &lt;a href=&quot;https://github.com/evilsocket/opensnitch/issues/304&quot;&gt;upstream
373 want a Debian package too&lt;/a&gt;.&lt;/p&gt;
374
375 &lt;p&gt;After struggling a bit with getting the program to run, figuring
376 out building Go programs (and a little failed detour to look at eBPF
377 builds too - help needed), I am very happy to report that I am
378 sponsoring upstream to maintain the package in Debian, and it has
379 since this morning been waiting in NEW for the ftpmasters to have a
380 look. Perhaps it can get into the archive in time for the Bookworm
381 release?&lt;/p&gt;
382
383 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
384 activities, please send Bitcoin donations to my address
385 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
386 </description>
387 </item>
388
389 <item>
390 <title>LinuxCNC MQTT publisher component</title>
391 <link>https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html</link>
392 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html</guid>
393 <pubDate>Sun, 8 Jan 2023 19:30:00 +0100</pubDate>
394 <description>&lt;p&gt;I watched &lt;a href=&quot;https://yewtu.be/watch?v=jmKUV3aNLjk&quot;&gt;a 2015
395 video from Andreas Schiffler&lt;/a&gt; the other day, where he set up
396 &lt;a href=&quot;https://linuxcnc.org/&quot;&gt;LinuxCNC&lt;/a&gt; to send status
397 information to the MQTT broker IBM Bluemix. As I also use MQTT for
398 graphing, it occured to me that a generic MQTT LinuxCNC component
399 would be useful and I set out to implement it. Today I got the first
400 draft limping along and submitted as
401 &lt;a href=&quot;https://github.com/LinuxCNC/linuxcnc/pull/2253&quot;&gt;a patch to the
402 LinuxCNC project&lt;/a&gt;.&lt;/p&gt;
403
404 &lt;p&gt;The simple part was setting up the MQTT publishing code in Python.
405 I already have set up other parts submitting data to my Mosquito MQTT
406 broker, so I could reuse that code. Writing a LinuxCNC component in
407 Python as new to me, but using existing examples in the code
408 repository and the extensive documentation, this was fairly straight
409 forward. The hardest part was creating a automated test for the
410 component to ensure it was working. Testing it in a simulated
411 LinuxCNC machine proved very useful, as I discovered features I needed
412 that I had not thought of yet, and adjusted the code quite a bit to
413 make it easier to test without a operational MQTT broker
414 available.&lt;/p&gt;
415
416 &lt;p&gt;The draft is ready and working, but I am unsure which LinuxCNC HAL
417 pins I should collect and publish by default (in other words, the
418 default set of information pieces published), and how to get the
419 machine name from the LinuxCNC INI file. The latter is a minor
420 detail, but I expect it would be useful in a setup with several
421 machines available. I am hoping for feedback from the experienced
422 LinuxCNC developers and users, to make the component even better
423 before it can go into the mainland LinuxCNC code base.&lt;/p&gt;
424
425 &lt;p&gt;Since I started on the MQTT component, I came across
426 &lt;a href=&quot;https://yewtu.be/watch?v=Bqa2grG0XtA&quot;&gt;another video from Kent
427 VanderVelden&lt;/a&gt; where he combine LinuxCNC with a set of screen glasses
428 controlled by a Raspberry Pi, and it occured to me that it would
429 be useful for such use cases if LinuxCNC also provided a REST API for
430 querying its status. I hope to start on such component once the MQTT
431 component is working well.&lt;/p&gt;
432
433 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
434 activities, please send Bitcoin donations to my address
435 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
436 </description>
437 </item>
438
439 <item>
440 <title>ONVIF IP camera management tool finally in Debian</title>
441 <link>https://people.skolelinux.org/pere/blog/ONVIF_IP_camera_management_tool_finally_in_Debian.html</link>
442 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/ONVIF_IP_camera_management_tool_finally_in_Debian.html</guid>
443 <pubDate>Sat, 24 Dec 2022 08:00:00 +0100</pubDate>
444 <description>&lt;p&gt;Merry Christmas to you all. Here is a small gift to all those with
445 IP cameras following the &lt;a href=&quot;https://www.onvif.org/&quot;&gt;ONVIF
446 specification&lt;/a&gt;. There is finally a nice command line and GUI tool
447 in Debian to manage ONVIF IP cameras. After working with upstream for
448 a few months and sponsoring the upload, I am very happy to report that
449 the &lt;a href=&quot;https://tracker.debian.org/libonvif&quot;&gt;libonvif package&lt;/a&gt;
450 entered Debian Sid last night.&lt;/p&gt;
451
452 &lt;p&gt;The package provide a C library to communicate with such cameras, a
453 command line tool to locate and update settings of (like password) the
454 cameras and a GUI tool to configure and control the units as well as
455 preview the video from the camera. Libonvif is available on Both
456 Linux and Windows and the GUI tool uses the Qt library. The main
457 competitors are non-free software, while libonvif is GNU GPL licensed.
458 I am very glad Debian users in the future can control their cameras
459 using a free software system provided by Debian. But the ONVIF world
460 is full of slightly broken firmware, where the cameras pretend to
461 follow the ONVIF specification but fail to set some configuration
462 values or refuse to provide video to more than one recipient at the
463 time, and the onvif project is quite young and might take a while
464 before it completely work with your camera. Upstream seem eager to
465 improve the library, so handling any broken camera might be just &lt;a
466 href=&quot;https://github.com/sr99622/libonvif/&quot;&gt;a bug report away&lt;/a&gt;.&lt;/p&gt;
467
468 &lt;p&gt;The package just cleared NEW, and need a new source only upload
469 before it can enter testing. This will happen in the next few
470 days.&lt;/p&gt;
471
472 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
473 activities, please send Bitcoin donations to my address
474 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
475 </description>
476 </item>
477
478 <item>
479 <title>Managing and using ONVIF IP cameras with Linux</title>
480 <link>https://people.skolelinux.org/pere/blog/Managing_and_using_ONVIF_IP_cameras_with_Linux.html</link>
481 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Managing_and_using_ONVIF_IP_cameras_with_Linux.html</guid>
482 <pubDate>Wed, 19 Oct 2022 12:30:00 +0200</pubDate>
483 <description>&lt;p&gt;Recently I have been looking at how to control and collect data
484 from a handful IP cameras using Linux. I both wanted to change their
485 settings and to make their imagery available via a free software
486 service under my control. Here is a summary of the tools I found.&lt;/p&gt;
487
488 &lt;p&gt;First I had to identify the cameras and their protocols. As far as
489 I could tell, they were using some SOAP looking protocol and their
490 internal web server seem to only work with Microsoft Internet Explorer
491 with some proprietary binary plugin, which in these days of course is
492 a security disaster and also made it impossible for me to use the
493 camera web interface. Luckily I discovered that the SOAP looking
494 protocol is actually following &lt;a href=&quot;https://www.onvif.org/&quot;&gt;the
495 ONVIF specification&lt;/a&gt;, which seem to be supported by a lot of IP
496 cameras these days.&lt;/p&gt;
497
498 &lt;p&gt;Once the protocol was identified, I was able to find what appear to
499 be the most popular way to configure ONVIF cameras, the free software
500 Windows tool named
501 &lt;a href=&quot;https://sourceforge.net/projects/onvifdm/&quot;&gt;ONVIF Device
502 Manager&lt;/a&gt;. Lacking any other options at the time, I tried
503 unsuccessfully to get it running using Wine, but was missing a dotnet
504 40 library and I found no way around it to run it on Linux.&lt;/p&gt;
505
506 &lt;p&gt;The next tool I found to configure the cameras were a non-free Linux Qt
507 client &lt;a href=&quot;https://www.lingodigit.com/onvif_nvcdemo.html&quot;&gt;ONVIF
508 Device Tool&lt;/a&gt;. I did not like its terms of use, so did not spend
509 much time on it.&lt;/p&gt;
510
511 &lt;p&gt;To collect the video and make it available in a web interface, I
512 found the Zoneminder tool in Debian. A recent version was able to
513 automatically detect and configure ONVIF devices, so I could use it to
514 set up motion detection in and collection of the camera output. I had
515 initial problems getting the ONVIF autodetection to work, as both
516 Firefox and Chromium &lt;a href=&quot;https://bugs.debian.org/1001188&quot;&gt;refused
517 the inter-tab communication&lt;/a&gt; being used by the Zoneminder web
518 pages, but managed to get konqueror to work. Apparently the &quot;Enhanced
519 Tracking Protection&quot; in Firefox cause the problem. I ended up
520 upgrading to the Bookworm edition of Zoneminder in the process to try
521 to fix the issue, and believe the problem might be solved now.&lt;/p&gt;
522
523 &lt;p&gt;In the process I came across the nice Linux GUI tool
524 &lt;a href=&quot;https://gitlab.com/caspermeijn/onvifviewer/&quot;&gt;ONVIF Viewer&lt;/a&gt;
525 allowing me to preview the camera output and validate the login
526 passwords required. Sadly its author has grown tired of maintaining
527 the software, so it might not see any future updates. Which is sad,
528 as the viewer is sightly unstable and the picture tend to lock up.
529 Note, this lockup might be due to limitations in the cameras and not
530 the viewer implementation. I suspect the camera is only able to
531 provide pictures to one client at the time, and the Zoneminder feed
532 might interfere with the GUI viewer. I have
533 &lt;a href=&quot;https://bugs.debian.org/1000820&quot;&gt;asked for the tool to be
534 included in Debian&lt;/a&gt;.&lt;/p&gt;
535
536 &lt;p&gt;Finally, I found what appear to be very nice Linux free software
537 replacement for the Windows tool, named
538 &lt;a href=&quot;https://github.com/sr99622/libonvif/&quot;&gt;libonvif&lt;/a&gt;. It
539 provide a C library to talk to ONVIF devices as well as a command line
540 and GUI tool using the library. Using the GUI tool I was able to change
541 the admin passwords and update other settings of the cameras. I have
542 &lt;a href=&quot;https://bugs.debian.org/1021980&quot;&gt;asked for the package to be
543 included in Debian&lt;/a&gt;.&lt;/p&gt;
544
545 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
546 activities, please send Bitcoin donations to my address
547 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
548
549 &lt;p&gt;&lt;strong&gt;Update 2022-10-20&lt;/strong&gt;: Since my initial publication of
550 this text, I got several suggestions for more free software Linux
551 tools. There is &lt;a href=&quot;https://github.com/quatanium/python-onvif&quot;&gt;a
552 ONVIF python library&lt;/a&gt; (already
553 &lt;a href=&quot;https://bugs.debian.org/824240&quot;&gt;requested into Debian&lt;/a&gt;) and
554 &lt;a href=&quot;https://github.com/FalkTannhaeuser/python-onvif-zeep&quot;&gt;a python 3
555 fork&lt;/a&gt; using a different SOAP dependency. There is also
556 &lt;a href=&quot;https://www.home-assistant.io/integrations/onvif/&quot;&gt;support for
557 ONVIF in Home Assistant&lt;/a&gt;, and there is an alternative to Zoneminder
558 called &lt;a href=&quot;https://www.shinobi.video/&quot;&gt;Shinobi&lt;/a&gt;. The latter
559 two are not included in Debian either. I have not tested any of these
560 so far.&lt;/p&gt;
561 </description>
562 </item>
563
564 <item>
565 <title>Time to translate the Bullseye edition of the Debian Administrator&#39;s Handbook</title>
566 <link>https://people.skolelinux.org/pere/blog/Time_to_translate_the_Bullseye_edition_of_the_Debian_Administrator_s_Handbook.html</link>
567 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Time_to_translate_the_Bullseye_edition_of_the_Debian_Administrator_s_Handbook.html</guid>
568 <pubDate>Mon, 12 Sep 2022 15:45:00 +0200</pubDate>
569 <description>&lt;p align=&quot;center&quot;&gt;&lt;img align=&quot;center&quot; src=&quot;http://people.skolelinux.org/pere/blog/images/2020-10-20-debian-handbook-nb-testprint.jpeg&quot; width=&quot;60%&quot;/&gt;&lt;/p&gt;
570
571 &lt;p&gt;(The picture is of the previous edition.)&lt;/p&gt;
572
573 &lt;p&gt;Almost two years after the previous Norwegian Bokmål translation of
574 the &quot;&lt;a href=&quot;https://debian-handbook.info/&quot;&gt;The Debian Administrator&#39;s
575 Handbook&lt;/a&gt;&quot; was published, a new edition is finally being prepared. The
576 english text is updated, and it is time to start working on the
577 translations. Around 37 percent of the strings have been updated, one
578 way or another, and the translations starting from a complete Debian Buster
579 edition now need to bring their translation up from 63% to 100%. The
580 complete book is licensed using a Creative Commons license, and has
581 been published in several languages over the years. The translations
582 are done by volunteers to bring Linux in their native tongue. The
583 last time I checked, it complete text was available in English,
584 Norwegian Bokmål, German, Indonesian, Brazil Portuguese and Spanish.
585 In addition, work has been started for Arabic (Morocco), Catalan,
586 Chinese (Simplified), Chinese (Traditional), Croatian, Czech, Danish,
587 Dutch, French, Greek, Italian, Japanese, Korean, Persian, Polish,
588 Romanian, Russian, Swedish, Turkish and Vietnamese.&lt;/p&gt;
589
590 &lt;p&gt;The translation is conducted on
591 &lt;a href=&quot;https://hosted.weblate.org/projects/debian-handbook/&quot;&gt;the
592 hosted weblate project page&lt;/a&gt;. Prospective translators are
593 recommeded to subscribe to
594 &lt;a href=&quot;http://lists.alioth.debian.org/mailman/listinfo/debian-handbook-translators&quot;&gt;the
595 translators mailing list&lt;/a&gt; and should also check out
596 &lt;a href=&quot;https://debian-handbook.info/contribute/&quot;&gt;the instructions for
597 contributors&lt;/a&gt;.&lt;/p&gt;
598
599 &lt;p&gt;I am one of the Norwegian Bokmål translators of this book, and we
600 have just started. Your contribution is most welcome.&lt;/p&gt;
601
602 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
603 activities, please send Bitcoin donations to my address
604 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
605 </description>
606 </item>
607
608 <item>
609 <title>Automatic LinuxCNC servo PID tuning?</title>
610 <link>https://people.skolelinux.org/pere/blog/Automatic_LinuxCNC_servo_PID_tuning_.html</link>
611 <guid isPermaLink="true">https://people.skolelinux.org/pere/blog/Automatic_LinuxCNC_servo_PID_tuning_.html</guid>
612 <pubDate>Sat, 16 Jul 2022 22:30:00 +0200</pubDate>
613 <description>&lt;p&gt;While working on a CNC with servo motors controlled by the
614 &lt;a href=&quot;https://en.wikipedia.org/wiki/LinuxCNC&quot;&gt;LinuxCNC&lt;/a&gt;
615 &lt;a href=&quot;https://en.wikipedia.org/wiki/PID_controller&quot;&gt;PID
616 controller&lt;/a&gt;, I recently had to learn how to tune the collection of values
617 that control such mathematical machinery that a PID controller is. It
618 proved to be a lot harder than I hoped, and I still have not succeeded
619 in getting the Z PID controller to successfully defy gravity, nor X
620 and Y to move accurately and reliably. But while climbing up this
621 rather steep learning curve, I discovered that some motor control
622 systems are able to tune their PID controllers. I got the impression
623 from the documentation that LinuxCNC were not. This proved to be not
624 true.&lt;/p&gt;
625
626 &lt;p&gt;The LinuxCNC
627 &lt;a href=&quot;http://linuxcnc.org/docs/html/man/man9/pid.9.html&quot;&gt;pid
628 component&lt;/a&gt; is the recommended PID controller to use. It uses eight
629 constants &lt;tt&gt;Pgain&lt;/tt&gt;, &lt;tt&gt;Igain&lt;/tt&gt;, &lt;tt&gt;Dgain&lt;/tt&gt;,
630 &lt;tt&gt;bias&lt;/tt&gt;, &lt;tt&gt;FF0&lt;/tt&gt;, &lt;tt&gt;FF1&lt;/tt&gt;, &lt;tt&gt;FF2&lt;/tt&gt; and
631 &lt;tt&gt;FF3&lt;/tt&gt; to calculate the output value based on current and wanted
632 state, and all of these need to have a sensible value for the
633 controller to behave properly. Note, there are even more values
634 involved, theser are just the most important ones. In my case I need
635 the X, Y and Z axes to follow the requested path with little error.
636 This has proved quite a challenge for someone who have never tuned a
637 PID controller before, but there is at least some help to be found.
638
639 &lt;p&gt;I discovered that included in LinuxCNC was this old PID component
640 at_pid claiming to have auto tuning capabilities. Sadly it had been
641 neglected since 2011, and could not be used as a plug in replacement
642 for the default pid component. One would have to rewriting the
643 LinuxCNC HAL setup to test at_pid. This was rather sad, when I wanted
644 to quickly test auto tuning to see if it did a better job than me at
645 figuring out good P, I and D values to use.&lt;/p&gt;
646
647 &lt;p&gt;I decided to have a look if the situation could be improved. This
648 involved trying to understand the code and history of the pid and
649 at_pid components. Apparently they had a common ancestor, as code
650 structure, comments and variable names were quite close to each other.
651 Sadly this was not reflected in the git history, making it hard to
652 figure out what really happened. My guess is that the author of
653 &lt;a href=&quot;https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/components/at_pid.c&quot;&gt;at_pid.c&lt;/a&gt;
654 took a version of
655 &lt;a href=&quot;https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/components/pid.c&quot;&gt;pid.c&lt;/a&gt;,
656 rewrote it to follow the structure he wished pid.c to have, then added
657 support for auto tuning and finally got it included into the LinuxCNC
658 repository. The restructuring and lack of early history made it
659 harder to figure out which part of the code were relevant to the auto
660 tuning, and which part of the code needed to be updated to work the
661 same way as the current pid.c implementation. I started by trying to
662 isolate relevant changes in pid.c, and applying them to at_pid.c. My
663 aim was to make sure the at_pid component could replace the pid
664 component with a simple change in the HAL setup loadrt line, without
665 having to &quot;rewire&quot; the rest of the HAL configuration. After a few
666 hours following this approach, I had learned quite a lot about the
667 code structure of both components, while concluding I was heading down
668 the wrong rabbit hole, and should get back to the surface and find a
669 different path.&lt;/p&gt;
670
671 &lt;p&gt;For the second attempt, I decided to throw away all the PID control
672 related part of the original at_pid.c, and instead isolate and lift
673 the auto tuning part of the code and inject it into a copy of pid.c.
674 This ensured compatibility with the current pid component, while
675 adding auto tuning as a run time option. To make it easier to identify
676 the relevant parts in the future, I wrapped all the auto tuning code
677 with &#39;#ifdef AUTO_TUNER&#39;. The end result behave just like the current
678 pid component by default, as that part of the code is identical. The
679 &lt;a href=&quot;https://github.com/LinuxCNC/linuxcnc/pull/1820&quot;&gt;end result
680 entered the LinuxCNC master branch&lt;/a&gt; a few days ago.&lt;/p&gt;
681
682 &lt;p&gt;To enable auto tuning, one need to set a few HAL pins in the PID
683 component. The most important ones are &lt;tt&gt;tune-effort&lt;/tt&gt;,
684 &lt;tt&gt;tune-mode&lt;/tt&gt; and &lt;tt&gt;tune-start&lt;/tt&gt;. But lets take a step
685 back, and see what the auto tuning code will do. I do not know the
686 mathematical foundation of the at_pid algorithm, but from observation
687 I can tell that the algorithm will, when enabled, produce a square
688 wave pattern centered around the &lt;tt&gt;bias&lt;/tt&gt; value on the output pin
689 of the PID controller. This can be seen using the HAL Scope provided
690 by LinuxCNC. In my case, this is translated into voltage (+-10V) sent
691 to the motor controller, which in turn is translated into motor speed.
692 So at_pid will ask the motor to move the axis back and forth. The
693 number of cycles in the pattern is controlled by the
694 &lt;tt&gt;tune-cycles&lt;/tt&gt; pin, and the extremes of the wave pattern is
695 controlled by the &lt;tt&gt;tune-effort&lt;/tt&gt; pin. Of course, trying to
696 change the direction of a physical object instantly (as in going
697 directly from a positive voltage to the equivalent negative voltage)
698 do not change velocity instantly, and it take some time for the object
699 to slow down and move in the opposite direction. This result in a
700 more smooth movement wave form, as the axis in question were vibrating
701 back and forth. When the axis reached the target speed in the
702 opposing direction, the auto tuner change direction again. After
703 several of these changes, the average time delay between the &#39;peaks&#39;
704 and &#39;valleys&#39; of this movement graph is then used to calculate
705 proposed values for Pgain, Igain and Dgain, and insert them into the
706 HAL model to use by the pid controller. The auto tuned settings are
707 not great, but htye work a lot better than the values I had been able
708 to cook up on my own, at least for the horizontal X and Y axis. But I
709 had to use very small &lt;tt&gt;tune-effort&lt;tt&gt; values, as my motor
710 controllers error out if the voltage change too quickly. I&#39;ve been
711 less lucky with the Z axis, which is moving a heavy object up and
712 down, and seem to confuse the algorithm. The Z axis movement became a
713 lot better when I introduced a &lt;tt&gt;bias&lt;/tt&gt; value to counter the
714 gravitational drag, but I will have to work a lot more on the Z axis
715 PID values.&lt;/p&gt;
716
717 &lt;p&gt;Armed with this knowledge, it is time to look at how to do the
718 tuning. Lets say the HAL configuration in question load the PID
719 component for X, Y and Z like this:&lt;/p&gt;
720
721 &lt;blockquote&gt;&lt;pre&gt;
722 loadrt pid names=pid.x,pid.y,pid.z
723 &lt;/pre&gt;&lt;/blockquote&gt;
724
725 &lt;p&gt;Armed with the new and improved at_pid component, the new line will
726 look like this:&lt;/p&gt;
727
728 &lt;blockquote&gt;&lt;pre&gt;
729 loadrt at_pid names=pid.x,pid.y,pid.z
730 &lt;/pre&gt;&lt;/blockquote&gt;
731
732 &lt;p&gt;The rest of the HAL setup can stay the same. This work because the
733 components are referenced by name. If the component had used count=3
734 instead, all use of pid.# had to be changed to at_pid.#.&lt;/p&gt;
735
736 &lt;p&gt;To start tuning the X axis, move the axis to the middle of its
737 range, to make sure it do not hit anything when it start moving back
738 and forth. Next, set the &lt;tt&gt;tune-effort&lt;/tt&gt; to a low number in the
739 output range. I used 0.1 as my initial value. Next, assign 1 to the
740 &lt;tt&gt;tune-mode&lt;/tt&gt; value. Note, this will disable the pid controlling
741 part and feed 0 to the output pin, which in my case initially caused a
742 lot of drift. In my case it proved to be a good idea with X and Y to
743 tune the motor driver to make sure 0 voltage stopped the motor
744 rotation. On the other hand, for the Z axis this proved to be a bad
745 idea, so it will depend on your setup. It might help to set the
746 &lt;tt&gt;bias&lt;/tt&gt; value to a output value that reduce or eliminate the
747 axis drift. Finally, after setting &lt;tt&gt;tune-mode&lt;/tt&gt;, set
748 &lt;tt&gt;tune-start&lt;/tt&gt; to 1 to activate the auto tuning. If all go well,
749 your axis will vibrate for a few seconds and when it is done, new
750 values for Pgain, Igain and Dgain will be active. To test them,
751 change &lt;tt&gt;tune-mode&lt;/tt&gt; back to 0. Note that this might cause the
752 machine to suddenly jerk as it bring the axis back to its commanded
753 position, which it might have drifted away from during tuning. To
754 summarize with some halcmd lines:&lt;/p&gt;
755
756 &lt;blockquote&gt;&lt;pre&gt;
757 setp pid.x.tune-effort 0.1
758 setp pid.x.tune-mode 1
759 setp pid.x.tune-start 1
760 # wait for the tuning to complete
761 setp pid.x.tune-mode 0
762 &lt;/pre&gt;&lt;/blockquote&gt;
763
764 &lt;p&gt;After doing this task quite a few times while trying to figure out
765 how to properly tune the PID controllers on the machine in, I decided
766 to figure out if this process could be automated, and wrote a script
767 to do the entire tuning process from power on. The end result will
768 ensure the machine is powered on and ready to run, home all axis if it
769 is not already done, check that the extra tuning pins are available,
770 move the axis to its mid point, run the auto tuning and re-enable the
771 pid controller when it is done. It can be run several times. Check
772 out the
773 &lt;a href=&quot;https://github.com/SebKuzminsky/MazakVQC1540/blob/bon-dev/scripts/run-auto-pid-tuner&quot;&gt;run-auto-pid-tuner&lt;/a&gt;
774 script on github if you want to learn how it is done.&lt;/p&gt;
775
776 &lt;p&gt;My hope is that this little adventure can inspire someone who know
777 more about motor PID controller tuning can implement even better
778 algorithms for automatic PID tuning in LinuxCNC, making life easier
779 for both me and all the others that want to use LinuxCNC but lack the
780 in depth knowledge needed to tune PID controllers well.&lt;/p&gt;
781
782 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
783 activities, please send Bitcoin donations to my address
784 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
785 </description>
786 </item>
787
788 </channel>
789 </rss>