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">
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" />
10 <title>OpenSnitch available in Debian Sid and Bookworm
</title>
11 <link>https://people.skolelinux.org/pere/blog/OpenSnitch_available_in_Debian_Sid_and_Bookworm.html
</link>
12 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/OpenSnitch_available_in_Debian_Sid_and_Bookworm.html
</guid>
13 <pubDate>Sat,
25 Feb
2023 20:
30:
00 +
0100</pubDate>
14 <description><p
>Thanks to the efforts of the OpenSnitch lead developer Gustavo
15 Iñiguez Goya allowing me to sponsor the upload,
16 <a href=
"https://tracker.debian.org/pkg/opensnitch
">the interactive
17 application firewall OpenSnitch
</a
> is now available in Debian
18 Testing, soon to become the next stable release of Debian.
</p
>
20 <p
>This is a package which set up a network firewall on one or more
21 machines, which is controlled by a graphical user interface that will
22 ask the user if a program should be allowed to connect to the local
23 network or the Internet. If some background daemon is trying to dial
24 home, it can be blocked from doing so with a simple mouse click, or by
25 default simply by not doing anything when the GUI question dialog pop
26 up. A list of all programs discovered using the network is provided
27 in the GUI, giving the user an overview of how the machine(s) programs
28 use the network.
</p
>
30 <p
>OpenSnitch was uploaded for NEW processing about a month ago, and I
31 had little hope of it getting accepted and shaping up in time for the
32 package freeze, but the Debian ftpmasters proved to be amazingly quick
33 at checking out the package and it was accepted into the archive about
34 week after the first upload. It is now team maintained under the Go
35 language team umbrella. A few fixes to the default setup is only in
36 Sid, and should migrate to Testing/Bookworm in a week.
</p
>
38 <p
>During testing I ran into an
39 <a href=
"https://github.com/evilsocket/opensnitch/issues/
813">issue
40 with Minecraft server broadcasts disappearing
</a
>, which was quickly
41 resolved by the developer with a patch and a proposed configuration
42 change. I
've been told this was caused by the Debian packages default
43 use if /proc/ information to track down kernel status, instead of the
44 newer eBPF module that can be used. The reason is simply that
45 upstream and I have failed to find a way to build the eBPF modules for
46 OpenSnitch without a complete configured Linux kernel source tree,
47 which as far as we can tell is unavailable as a build dependency in
48 Debian. We tried unsuccessfully so far to use the kernel-headers
49 package. It would be great if someone could provide some clues how to
50 build eBPF modules on build daemons in Debian, possibly without the full
51 kernel source.
</p
>
53 <p
>As usual, if you use Bitcoin and want to show your support of my
54 activities, please send Bitcoin donations to my address
55 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
60 <title>Is the desktop recommending your program for opening its files?
</title>
61 <link>https://people.skolelinux.org/pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html
</link>
62 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html
</guid>
63 <pubDate>Sun,
29 Jan
2023 11:
00:
00 +
0100</pubDate>
64 <description><p
>Linux desktop systems
65 <a href=
"https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
">have
66 standardized
</a
> how programs present themselves to the desktop
67 system. If a package include a .desktop file in
68 /usr/share/applications/, Gnome, KDE, LXDE, Xfce and the other desktop
69 environments will pick up the file and use its content to generate the
70 menu of available programs in the system. A lesser known fact is that
71 a package can also explain to the desktop system how to recognize the
72 files created by the program in question, and use it to open these
73 files on request, for example via a GUI file browser.
</p
>
75 <p
>A while back I ran into a package that did not tell the desktop
76 system how to recognize its files and was not used to open its files
77 in the file browser and fixed it. In the process I wrote a simple
78 debian/tests/ script to ensure the setup keep working. It might be
79 useful for other packages too, to ensure any future version of the
80 package keep handling its own files.
</p
>
82 <p
>For this to work the file format need a useful MIME type that can
83 be used to identify the format. If the file format do not yet have a
84 MIME type, it should define one and preferably also
85 <a href=
"https://www.iana.org/assignments/media-types/media-types.xhtml
">register
86 it with IANA
</a
> to ensure the MIME type string is reserved.
</p
>
88 <p
>The script uses the
<tt
>xdg-mime
</tt
> program from xdg-utils to
89 query the database of standardized package information and ensure it
90 return sensible values. It also need the location of an example file
91 for xdg-mime to guess the format of.
</p
>
96 # Author: Petter Reinholdtsen
97 # License: GPL v2 or later at your choice.
99 # Validate the MIME setup, making sure motor types have
100 # application/vnd.openmotor+yaml associated with them and is connected
101 # to the openmotor desktop file.
105 mimetype=
"application/vnd.openmotor+yaml
"
106 testfile=
"test/data/real/o3100/motor.ric
"
107 mydesktopfile=
"openmotor.desktop
"
109 filemime=
"$(xdg-mime query filetype
"$testfile
")
"
111 if [
"$mimetype
" !=
"$filemime
" ] ; then
113 echo
"error: xdg-mime claim motor file MIME type is $filemine, not $mimetype
"
115 echo
"success: xdg-mime report correct mime type $mimetype for motor file
"
118 desktop=$(xdg-mime query default
"$mimetype
")
120 if [
"$mydesktopfile
" !=
"$desktop
" ]; then
122 echo
"error: xdg-mime claim motor file should be handled by $desktop, not $mydesktopfile
"
124 echo
"success: xdg-mime agree motor file should be handled by $mydesktopfile
"
130 <p
>It is a simple way to ensure your users are not very surprised when
131 they try to open one of your file formats in their file browser.
</p
>
133 <p
>As usual, if you use Bitcoin and want to show your support of my
134 activities, please send Bitcoin donations to my address
135 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
140 <title>Opensnitch, the application level interactive firewall, heading into the Debian archive
</title>
141 <link>https://people.skolelinux.org/pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html
</link>
142 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html
</guid>
143 <pubDate>Sun,
22 Jan
2023 23:
55:
00 +
0100</pubDate>
144 <description><p
>While reading a
145 <a href=
"https://sneak.berlin/
20230115/macos-scans-your-local-files-now/
">blog
146 post claiming MacOS X recently started scanning local files and
147 reporting information about them to Apple
</a
>, even on a machine where
148 all such callback features had been disabled, I came across a
149 description of the Little Snitch application for MacOS X. It seemed
150 like a very nice tool to have in the tool box, and I decided to see if
151 something similar was available for Linux.
</p
>
153 <p
>It did not take long to find
154 <a href=
"https://github.com/evilsocket/opensnitch
">the OpenSnitch
155 package
</a
>, which has been in development since
2017, and now is in
156 version
1.5.0. It has had a
157 <a href=
"https://bugs.debian.org/
909567">request for Debian
158 packaging
</a
> since
2018, but no-one completed the job so far. Just
159 for fun, I decided to see if I could help, and I was very happy to
161 <a href=
"https://github.com/evilsocket/opensnitch/issues/
304">upstream
162 want a Debian package too
</a
>.
</p
>
164 <p
>After struggling a bit with getting the program to run, figuring
165 out building Go programs (and a little failed detour to look at eBPF
166 builds too - help needed), I am very happy to report that I am
167 sponsoring upstream to maintain the package in Debian, and it has
168 since this morning been waiting in NEW for the ftpmasters to have a
169 look. Perhaps it can get into the archive in time for the Bookworm
172 <p
>As usual, if you use Bitcoin and want to show your support of my
173 activities, please send Bitcoin donations to my address
174 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
179 <title>LinuxCNC MQTT publisher component
</title>
180 <link>https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html
</link>
181 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html
</guid>
182 <pubDate>Sun,
8 Jan
2023 19:
30:
00 +
0100</pubDate>
183 <description><p
>I watched
<a href=
"https://yewtu.be/watch?v=jmKUV3aNLjk
">a
2015
184 video from Andreas Schiffler
</a
> the other day, where he set up
185 <a href=
"https://linuxcnc.org/
">LinuxCNC
</a
> to send status
186 information to the MQTT broker IBM Bluemix. As I also use MQTT for
187 graphing, it occured to me that a generic MQTT LinuxCNC component
188 would be useful and I set out to implement it. Today I got the first
189 draft limping along and submitted as
190 <a href=
"https://github.com/LinuxCNC/linuxcnc/pull/
2253">a patch to the
191 LinuxCNC project
</a
>.
</p
>
193 <p
>The simple part was setting up the MQTT publishing code in Python.
194 I already have set up other parts submitting data to my Mosquito MQTT
195 broker, so I could reuse that code. Writing a LinuxCNC component in
196 Python as new to me, but using existing examples in the code
197 repository and the extensive documentation, this was fairly straight
198 forward. The hardest part was creating a automated test for the
199 component to ensure it was working. Testing it in a simulated
200 LinuxCNC machine proved very useful, as I discovered features I needed
201 that I had not thought of yet, and adjusted the code quite a bit to
202 make it easier to test without a operational MQTT broker
205 <p
>The draft is ready and working, but I am unsure which LinuxCNC HAL
206 pins I should collect and publish by default (in other words, the
207 default set of information pieces published), and how to get the
208 machine name from the LinuxCNC INI file. The latter is a minor
209 detail, but I expect it would be useful in a setup with several
210 machines available. I am hoping for feedback from the experienced
211 LinuxCNC developers and users, to make the component even better
212 before it can go into the mainland LinuxCNC code base.
</p
>
214 <p
>Since I started on the MQTT component, I came across
215 <a href=
"https://yewtu.be/watch?v=Bqa2grG0XtA
">another video from Kent
216 VanderVelden
</a
> where he combine LinuxCNC with a set of screen glasses
217 controlled by a Raspberry Pi, and it occured to me that it would
218 be useful for such use cases if LinuxCNC also provided a REST API for
219 querying its status. I hope to start on such component once the MQTT
220 component is working well.
</p
>
222 <p
>As usual, if you use Bitcoin and want to show your support of my
223 activities, please send Bitcoin donations to my address
224 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
229 <title>ONVIF IP camera management tool finally in Debian
</title>
230 <link>https://people.skolelinux.org/pere/blog/ONVIF_IP_camera_management_tool_finally_in_Debian.html
</link>
231 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/ONVIF_IP_camera_management_tool_finally_in_Debian.html
</guid>
232 <pubDate>Sat,
24 Dec
2022 08:
00:
00 +
0100</pubDate>
233 <description><p
>Merry Christmas to you all. Here is a small gift to all those with
234 IP cameras following the
<a href=
"https://www.onvif.org/
">ONVIF
235 specification
</a
>. There is finally a nice command line and GUI tool
236 in Debian to manage ONVIF IP cameras. After working with upstream for
237 a few months and sponsoring the upload, I am very happy to report that
238 the
<a href=
"https://tracker.debian.org/libonvif
">libonvif package
</a
>
239 entered Debian Sid last night.
</p
>
241 <p
>The package provide a C library to communicate with such cameras, a
242 command line tool to locate and update settings of (like password) the
243 cameras and a GUI tool to configure and control the units as well as
244 preview the video from the camera. Libonvif is available on Both
245 Linux and Windows and the GUI tool uses the Qt library. The main
246 competitors are non-free software, while libonvif is GNU GPL licensed.
247 I am very glad Debian users in the future can control their cameras
248 using a free software system provided by Debian. But the ONVIF world
249 is full of slightly broken firmware, where the cameras pretend to
250 follow the ONVIF specification but fail to set some configuration
251 values or refuse to provide video to more than one recipient at the
252 time, and the onvif project is quite young and might take a while
253 before it completely work with your camera. Upstream seem eager to
254 improve the library, so handling any broken camera might be just
<a
255 href=
"https://github.com/sr99622/libonvif/
">a bug report away
</a
>.
</p
>
257 <p
>The package just cleared NEW, and need a new source only upload
258 before it can enter testing. This will happen in the next few
261 <p
>As usual, if you use Bitcoin and want to show your support of my
262 activities, please send Bitcoin donations to my address
263 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
268 <title>Managing and using ONVIF IP cameras with Linux
</title>
269 <link>https://people.skolelinux.org/pere/blog/Managing_and_using_ONVIF_IP_cameras_with_Linux.html
</link>
270 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Managing_and_using_ONVIF_IP_cameras_with_Linux.html
</guid>
271 <pubDate>Wed,
19 Oct
2022 12:
30:
00 +
0200</pubDate>
272 <description><p
>Recently I have been looking at how to control and collect data
273 from a handful IP cameras using Linux. I both wanted to change their
274 settings and to make their imagery available via a free software
275 service under my control. Here is a summary of the tools I found.
</p
>
277 <p
>First I had to identify the cameras and their protocols. As far as
278 I could tell, they were using some SOAP looking protocol and their
279 internal web server seem to only work with Microsoft Internet Explorer
280 with some proprietary binary plugin, which in these days of course is
281 a security disaster and also made it impossible for me to use the
282 camera web interface. Luckily I discovered that the SOAP looking
283 protocol is actually following
<a href=
"https://www.onvif.org/
">the
284 ONVIF specification
</a
>, which seem to be supported by a lot of IP
285 cameras these days.
</p
>
287 <p
>Once the protocol was identified, I was able to find what appear to
288 be the most popular way to configure ONVIF cameras, the free software
290 <a href=
"https://sourceforge.net/projects/onvifdm/
">ONVIF Device
291 Manager
</a
>. Lacking any other options at the time, I tried
292 unsuccessfully to get it running using Wine, but was missing a dotnet
293 40 library and I found no way around it to run it on Linux.
</p
>
295 <p
>The next tool I found to configure the cameras were a non-free Linux Qt
296 client
<a href=
"https://www.lingodigit.com/onvif_nvcdemo.html
">ONVIF
297 Device Tool
</a
>. I did not like its terms of use, so did not spend
298 much time on it.
</p
>
300 <p
>To collect the video and make it available in a web interface, I
301 found the Zoneminder tool in Debian. A recent version was able to
302 automatically detect and configure ONVIF devices, so I could use it to
303 set up motion detection in and collection of the camera output. I had
304 initial problems getting the ONVIF autodetection to work, as both
305 Firefox and Chromium
<a href=
"https://bugs.debian.org/
1001188">refused
306 the inter-tab communication
</a
> being used by the Zoneminder web
307 pages, but managed to get konqueror to work. Apparently the
"Enhanced
308 Tracking Protection
" in Firefox cause the problem. I ended up
309 upgrading to the Bookworm edition of Zoneminder in the process to try
310 to fix the issue, and believe the problem might be solved now.
</p
>
312 <p
>In the process I came across the nice Linux GUI tool
313 <a href=
"https://gitlab.com/caspermeijn/onvifviewer/
">ONVIF Viewer
</a
>
314 allowing me to preview the camera output and validate the login
315 passwords required. Sadly its author has grown tired of maintaining
316 the software, so it might not see any future updates. Which is sad,
317 as the viewer is sightly unstable and the picture tend to lock up.
318 Note, this lockup might be due to limitations in the cameras and not
319 the viewer implementation. I suspect the camera is only able to
320 provide pictures to one client at the time, and the Zoneminder feed
321 might interfere with the GUI viewer. I have
322 <a href=
"https://bugs.debian.org/
1000820">asked for the tool to be
323 included in Debian
</a
>.
</p
>
325 <p
>Finally, I found what appear to be very nice Linux free software
326 replacement for the Windows tool, named
327 <a href=
"https://github.com/sr99622/libonvif/
">libonvif
</a
>. It
328 provide a C library to talk to ONVIF devices as well as a command line
329 and GUI tool using the library. Using the GUI tool I was able to change
330 the admin passwords and update other settings of the cameras. I have
331 <a href=
"https://bugs.debian.org/
1021980">asked for the package to be
332 included in Debian
</a
>.
</p
>
334 <p
>As usual, if you use Bitcoin and want to show your support of my
335 activities, please send Bitcoin donations to my address
336 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
338 <p
><strong
>Update
2022-
10-
20</strong
>: Since my initial publication of
339 this text, I got several suggestions for more free software Linux
340 tools. There is
<a href=
"https://github.com/quatanium/python-onvif
">a
341 ONVIF python library
</a
> (already
342 <a href=
"https://bugs.debian.org/
824240">requested into Debian
</a
>) and
343 <a href=
"https://github.com/FalkTannhaeuser/python-onvif-zeep
">a python
3
344 fork
</a
> using a different SOAP dependency. There is also
345 <a href=
"https://www.home-assistant.io/integrations/onvif/
">support for
346 ONVIF in Home Assistant
</a
>, and there is an alternative to Zoneminder
347 called
<a href=
"https://www.shinobi.video/
">Shinobi
</a
>. The latter
348 two are not included in Debian either. I have not tested any of these
354 <title>Time to translate the Bullseye edition of the Debian Administrator
's Handbook
</title>
355 <link>https://people.skolelinux.org/pere/blog/Time_to_translate_the_Bullseye_edition_of_the_Debian_Administrator_s_Handbook.html
</link>
356 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Time_to_translate_the_Bullseye_edition_of_the_Debian_Administrator_s_Handbook.html
</guid>
357 <pubDate>Mon,
12 Sep
2022 15:
45:
00 +
0200</pubDate>
358 <description><p align=
"center
"><img align=
"center
" src=
"http://people.skolelinux.org/pere/blog/images/
2020-
10-
20-debian-handbook-nb-testprint.jpeg
" width=
"60%
"/
></p
>
360 <p
>(The picture is of the previous edition.)
</p
>
362 <p
>Almost two years after the previous Norwegian Bokmål translation of
363 the
"<a href=
"https://debian-handbook.info/
">The Debian Administrator
's
364 Handbook
</a
>" was published, a new edition is finally being prepared. The
365 english text is updated, and it is time to start working on the
366 translations. Around
37 percent of the strings have been updated, one
367 way or another, and the translations starting from a complete Debian Buster
368 edition now need to bring their translation up from
63% to
100%. The
369 complete book is licensed using a Creative Commons license, and has
370 been published in several languages over the years. The translations
371 are done by volunteers to bring Linux in their native tongue. The
372 last time I checked, it complete text was available in English,
373 Norwegian Bokmål, German, Indonesian, Brazil Portuguese and Spanish.
374 In addition, work has been started for Arabic (Morocco), Catalan,
375 Chinese (Simplified), Chinese (Traditional), Croatian, Czech, Danish,
376 Dutch, French, Greek, Italian, Japanese, Korean, Persian, Polish,
377 Romanian, Russian, Swedish, Turkish and Vietnamese.
</p
>
379 <p
>The translation is conducted on
380 <a href=
"https://hosted.weblate.org/projects/debian-handbook/
">the
381 hosted weblate project page
</a
>. Prospective translators are
382 recommeded to subscribe to
383 <a href=
"http://lists.alioth.debian.org/mailman/listinfo/debian-handbook-translators
">the
384 translators mailing list
</a
> and should also check out
385 <a href=
"https://debian-handbook.info/contribute/
">the instructions for
386 contributors
</a
>.
</p
>
388 <p
>I am one of the Norwegian Bokmål translators of this book, and we
389 have just started. Your contribution is most welcome.
</p
>
391 <p
>As usual, if you use Bitcoin and want to show your support of my
392 activities, please send Bitcoin donations to my address
393 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
398 <title>Automatic LinuxCNC servo PID tuning?
</title>
399 <link>https://people.skolelinux.org/pere/blog/Automatic_LinuxCNC_servo_PID_tuning_.html
</link>
400 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/Automatic_LinuxCNC_servo_PID_tuning_.html
</guid>
401 <pubDate>Sat,
16 Jul
2022 22:
30:
00 +
0200</pubDate>
402 <description><p
>While working on a CNC with servo motors controlled by the
403 <a href=
"https://en.wikipedia.org/wiki/LinuxCNC
">LinuxCNC
</a
>
404 <a href=
"https://en.wikipedia.org/wiki/PID_controller
">PID
405 controller
</a
>, I recently had to learn how to tune the collection of values
406 that control such mathematical machinery that a PID controller is. It
407 proved to be a lot harder than I hoped, and I still have not succeeded
408 in getting the Z PID controller to successfully defy gravity, nor X
409 and Y to move accurately and reliably. But while climbing up this
410 rather steep learning curve, I discovered that some motor control
411 systems are able to tune their PID controllers. I got the impression
412 from the documentation that LinuxCNC were not. This proved to be not
415 <p
>The LinuxCNC
416 <a href=
"http://linuxcnc.org/docs/html/man/man9/pid
.9.html
">pid
417 component
</a
> is the recommended PID controller to use. It uses eight
418 constants
<tt
>Pgain
</tt
>,
<tt
>Igain
</tt
>,
<tt
>Dgain
</tt
>,
419 <tt
>bias
</tt
>,
<tt
>FF0
</tt
>,
<tt
>FF1
</tt
>,
<tt
>FF2
</tt
> and
420 <tt
>FF3
</tt
> to calculate the output value based on current and wanted
421 state, and all of these need to have a sensible value for the
422 controller to behave properly. Note, there are even more values
423 involved, theser are just the most important ones. In my case I need
424 the X, Y and Z axes to follow the requested path with little error.
425 This has proved quite a challenge for someone who have never tuned a
426 PID controller before, but there is at least some help to be found.
428 <p
>I discovered that included in LinuxCNC was this old PID component
429 at_pid claiming to have auto tuning capabilities. Sadly it had been
430 neglected since
2011, and could not be used as a plug in replacement
431 for the default pid component. One would have to rewriting the
432 LinuxCNC HAL setup to test at_pid. This was rather sad, when I wanted
433 to quickly test auto tuning to see if it did a better job than me at
434 figuring out good P, I and D values to use.
</p
>
436 <p
>I decided to have a look if the situation could be improved. This
437 involved trying to understand the code and history of the pid and
438 at_pid components. Apparently they had a common ancestor, as code
439 structure, comments and variable names were quite close to each other.
440 Sadly this was not reflected in the git history, making it hard to
441 figure out what really happened. My guess is that the author of
442 <a href=
"https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/components/at_pid.c
">at_pid.c
</a
>
444 <a href=
"https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/components/pid.c
">pid.c
</a
>,
445 rewrote it to follow the structure he wished pid.c to have, then added
446 support for auto tuning and finally got it included into the LinuxCNC
447 repository. The restructuring and lack of early history made it
448 harder to figure out which part of the code were relevant to the auto
449 tuning, and which part of the code needed to be updated to work the
450 same way as the current pid.c implementation. I started by trying to
451 isolate relevant changes in pid.c, and applying them to at_pid.c. My
452 aim was to make sure the at_pid component could replace the pid
453 component with a simple change in the HAL setup loadrt line, without
454 having to
"rewire
" the rest of the HAL configuration. After a few
455 hours following this approach, I had learned quite a lot about the
456 code structure of both components, while concluding I was heading down
457 the wrong rabbit hole, and should get back to the surface and find a
458 different path.
</p
>
460 <p
>For the second attempt, I decided to throw away all the PID control
461 related part of the original at_pid.c, and instead isolate and lift
462 the auto tuning part of the code and inject it into a copy of pid.c.
463 This ensured compatibility with the current pid component, while
464 adding auto tuning as a run time option. To make it easier to identify
465 the relevant parts in the future, I wrapped all the auto tuning code
466 with
'#ifdef AUTO_TUNER
'. The end result behave just like the current
467 pid component by default, as that part of the code is identical. The
468 <a href=
"https://github.com/LinuxCNC/linuxcnc/pull/
1820">end result
469 entered the LinuxCNC master branch
</a
> a few days ago.
</p
>
471 <p
>To enable auto tuning, one need to set a few HAL pins in the PID
472 component. The most important ones are
<tt
>tune-effort
</tt
>,
473 <tt
>tune-mode
</tt
> and
<tt
>tune-start
</tt
>. But lets take a step
474 back, and see what the auto tuning code will do. I do not know the
475 mathematical foundation of the at_pid algorithm, but from observation
476 I can tell that the algorithm will, when enabled, produce a square
477 wave pattern centered around the
<tt
>bias
</tt
> value on the output pin
478 of the PID controller. This can be seen using the HAL Scope provided
479 by LinuxCNC. In my case, this is translated into voltage (+-
10V) sent
480 to the motor controller, which in turn is translated into motor speed.
481 So at_pid will ask the motor to move the axis back and forth. The
482 number of cycles in the pattern is controlled by the
483 <tt
>tune-cycles
</tt
> pin, and the extremes of the wave pattern is
484 controlled by the
<tt
>tune-effort
</tt
> pin. Of course, trying to
485 change the direction of a physical object instantly (as in going
486 directly from a positive voltage to the equivalent negative voltage)
487 do not change velocity instantly, and it take some time for the object
488 to slow down and move in the opposite direction. This result in a
489 more smooth movement wave form, as the axis in question were vibrating
490 back and forth. When the axis reached the target speed in the
491 opposing direction, the auto tuner change direction again. After
492 several of these changes, the average time delay between the
'peaks
'
493 and
'valleys
' of this movement graph is then used to calculate
494 proposed values for Pgain, Igain and Dgain, and insert them into the
495 HAL model to use by the pid controller. The auto tuned settings are
496 not great, but htye work a lot better than the values I had been able
497 to cook up on my own, at least for the horizontal X and Y axis. But I
498 had to use very small
<tt
>tune-effort
<tt
> values, as my motor
499 controllers error out if the voltage change too quickly. I
've been
500 less lucky with the Z axis, which is moving a heavy object up and
501 down, and seem to confuse the algorithm. The Z axis movement became a
502 lot better when I introduced a
<tt
>bias
</tt
> value to counter the
503 gravitational drag, but I will have to work a lot more on the Z axis
504 PID values.
</p
>
506 <p
>Armed with this knowledge, it is time to look at how to do the
507 tuning. Lets say the HAL configuration in question load the PID
508 component for X, Y and Z like this:
</p
>
510 <blockquote
><pre
>
511 loadrt pid names=pid.x,pid.y,pid.z
512 </pre
></blockquote
>
514 <p
>Armed with the new and improved at_pid component, the new line will
515 look like this:
</p
>
517 <blockquote
><pre
>
518 loadrt at_pid names=pid.x,pid.y,pid.z
519 </pre
></blockquote
>
521 <p
>The rest of the HAL setup can stay the same. This work because the
522 components are referenced by name. If the component had used count=
3
523 instead, all use of pid.# had to be changed to at_pid.#.
</p
>
525 <p
>To start tuning the X axis, move the axis to the middle of its
526 range, to make sure it do not hit anything when it start moving back
527 and forth. Next, set the
<tt
>tune-effort
</tt
> to a low number in the
528 output range. I used
0.1 as my initial value. Next, assign
1 to the
529 <tt
>tune-mode
</tt
> value. Note, this will disable the pid controlling
530 part and feed
0 to the output pin, which in my case initially caused a
531 lot of drift. In my case it proved to be a good idea with X and Y to
532 tune the motor driver to make sure
0 voltage stopped the motor
533 rotation. On the other hand, for the Z axis this proved to be a bad
534 idea, so it will depend on your setup. It might help to set the
535 <tt
>bias
</tt
> value to a output value that reduce or eliminate the
536 axis drift. Finally, after setting
<tt
>tune-mode
</tt
>, set
537 <tt
>tune-start
</tt
> to
1 to activate the auto tuning. If all go well,
538 your axis will vibrate for a few seconds and when it is done, new
539 values for Pgain, Igain and Dgain will be active. To test them,
540 change
<tt
>tune-mode
</tt
> back to
0. Note that this might cause the
541 machine to suddenly jerk as it bring the axis back to its commanded
542 position, which it might have drifted away from during tuning. To
543 summarize with some halcmd lines:
</p
>
545 <blockquote
><pre
>
546 setp pid.x.tune-effort
0.1
547 setp pid.x.tune-mode
1
548 setp pid.x.tune-start
1
549 # wait for the tuning to complete
550 setp pid.x.tune-mode
0
551 </pre
></blockquote
>
553 <p
>After doing this task quite a few times while trying to figure out
554 how to properly tune the PID controllers on the machine in, I decided
555 to figure out if this process could be automated, and wrote a script
556 to do the entire tuning process from power on. The end result will
557 ensure the machine is powered on and ready to run, home all axis if it
558 is not already done, check that the extra tuning pins are available,
559 move the axis to its mid point, run the auto tuning and re-enable the
560 pid controller when it is done. It can be run several times. Check
562 <a href=
"https://github.com/SebKuzminsky/MazakVQC1540/blob/bon-dev/scripts/run-auto-pid-tuner
">run-auto-pid-tuner
</a
>
563 script on github if you want to learn how it is done.
</p
>
565 <p
>My hope is that this little adventure can inspire someone who know
566 more about motor PID controller tuning can implement even better
567 algorithms for automatic PID tuning in LinuxCNC, making life easier
568 for both me and all the others that want to use LinuxCNC but lack the
569 in depth knowledge needed to tune PID controllers well.
</p
>
571 <p
>As usual, if you use Bitcoin and want to show your support of my
572 activities, please send Bitcoin donations to my address
573 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
578 <title>My free software activity of late (
2022)
</title>
579 <link>https://people.skolelinux.org/pere/blog/My_free_software_activity_of_late__2022_.html
</link>
580 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/My_free_software_activity_of_late__2022_.html
</guid>
581 <pubDate>Mon,
20 Jun
2022 14:
30:
00 +
0200</pubDate>
582 <description><p
>I guess it is time to bring some light on the various free software
583 and open culture activities and projects I have worked on or been
584 involved in the last year and a half.
</p
>
586 <p
>First, lets mention the book
587 <a href=
"http://www.hungry.com/~pere/publisher/
">releases I managed to
588 publish
</a
>. The Cory Doctorow book
"Hvordan knuse
589 overvåkningskapitalismen
" argue that it is not the magic machine
590 learning of the big technology companies that causes the surveillance
591 capitalism to thrive, it is the lack of trust busting to enforce
592 existing anti-monopoly laws. I also published a family of
593 dictionaries for machinists, one sorted on the English words, one
594 sorted on the Norwegian and the last sorted on the North Sámi words.
595 A bit on the back burner but not forgotten is the Debian
596 Administrators Handbook, where a new edition is being worked on. I
597 have not spent as much time as I want to help bring it to completion,
598 but hope I will get more spare time to look at it before the end of
601 <p
>With my Debian had I have spent time on several projects, both
602 updating existing packages, helping to bring in new packages and
603 working with upstream projects to try to get them ready to go into
604 Debian. The list is rather long, and I will only mention my own
605 isenkram, openmotor, vlc bittorrent plugin, xprintidle, norwegian
606 letter style for latex, bs1770gain, and recordmydesktop. In addition
607 to these I have sponsored several packages into Debian, like audmes.
</p
>
609 <p
>The last year I have looked at several infrastructure projects for
610 collecting meter data and video surveillance recordings. This include
611 several ONVIF related tools like onvifviewer and zoneminder as well as
612 rtl-
433, wmbusmeters and rtl-wmbus.
</p
>
614 <p
>In parallel with this I have looked at fabrication related free
615 software solutions like pycam and LinuxCNC. The latter recently
616 gained improved translation support using po4a and weblate, which was
617 a harder nut to crack that I had anticipated when I started.
</p
>
619 <p
>Several hours have been spent translating free software to
620 Norwegian Bokmål on the Weblate hosted service. Do not have a
621 complete list, but you will find my contributions in at least gnucash,
622 minetest and po4a.
</p
>
624 <p
>I also spent quite some time on the Norwegian archiving specification
625 Noark
5, and its companion project Nikita implementing the API
626 specification for Noark
5.
</p
>
628 <p
>Recently I have been looking into free software tools to do company
629 accounting here in Norway., which present an interesting mix between
630 law, rules, regulations, format specifications and API interfaces.
</p
>
632 <p
>I guess I should also mention the Norwegian community driven
633 government interfacing projects Mimes Brønn and Fiksgatami, which have
634 ended up in a kind of limbo while the future of the projects is being
635 worked out.
</p
>
637 <p
>These are just a few of the projects I have been involved it, and
638 would like to give more visibility. I
'll stop here to avoid delaying
641 <p
>As usual, if you use Bitcoin and want to show your support of my
642 activities, please send Bitcoin donations to my address
643 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
648 <title>LinuxCNC translators life just got a bit easier
</title>
649 <link>https://people.skolelinux.org/pere/blog/LinuxCNC_translators_life_just_got_a_bit_easier.html
</link>
650 <guid isPermaLink=
"true">https://people.skolelinux.org/pere/blog/LinuxCNC_translators_life_just_got_a_bit_easier.html
</guid>
651 <pubDate>Fri,
3 Jun
2022 21:
10:
00 +
0200</pubDate>
652 <description><p
>Back in oktober last year, when I started looking at the
653 <a href=
"https://en.wikipedia.org/wiki/LinuxCNC
">LinuxCNC
</a
> system, I
654 proposed to change the documentation build system make life easier for
655 translators. The original system consisted of independently written
656 documentation files for each language, with no automated way to track
657 changes done in other translations and no help for the translators to
658 know how much was left to translated. By using
659 <a href=
"https://po4a.org/
">the po4a system
</a
> to generate POT and PO
660 files from the English documentation, this can be improved. A small
661 team of LinuxCNC contributors got together and today our labour
662 finally payed off. Since a few hours ago, it is now possible to
663 translate
<a href=
"https://hosted.weblate.org/projects/linuxcnc/
">the
664 LinuxCNC documentation on Weblate
</a
>, alongside the program itself.
</p
>
666 <p
>The effort to migrate the documentation to use po4a has been both
667 slow and frustrating. I am very happy we finally made it.
</p
>
669 <p
>As usual, if you use Bitcoin and want to show your support of my
670 activities, please send Bitcoin donations to my address
671 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>