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