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