From: Petter Reinholdtsen Date: Sun, 8 Jan 2023 18:27:30 +0000 (+0100) Subject: Ny post om LinuxCNC. X-Git-Url: https://pere.pagekite.me/gitweb/homepage.git/commitdiff_plain/1b5334c8739cdec37e5fd98dee6f085d890b5503 Ny post om LinuxCNC. --- diff --git a/blog/data/2023-01-08-linuxcnc-mqtt.txt b/blog/data/2023-01-08-linuxcnc-mqtt.txt new file mode 100644 index 0000000000..6d6c619c89 --- /dev/null +++ b/blog/data/2023-01-08-linuxcnc-mqtt.txt @@ -0,0 +1,45 @@ +Title: LinuxCNC MQTT publisher component +Tags: english, debian, linuxcnc, robot +Date: 2023-01-08 19:30 + +

I watched a 2015 +video from Andreas Schiffler the other day, where he set up +LinuxCNC to send status +information to the MQTT broker IBM Bluemix. As I also use MQTT for +graphing, it occured to me that a generic MQTT LinuxCNC component +would be useful and I set out to implement it. Today I got the first +draft limping along and submitted as +a patch to the +LinuxCNC project.

+ +

The simple part was setting up the MQTT publishing code in Python. +I already have set up other parts submitting data to my Mosquito MQTT +broker, so I could reuse that code. Writing a LinuxCNC component in +Python as new to me, but using existing examples in the code +repository, this was fairly straight forward. The hardest part was +creating a automated test for the component to ensure it was working. +Testing it in a simulated LinuxCNC machine proved very useful, as I +discovered features I needed that I had not thought of yet, and +adjusted the code quite a bit to make it easier to test without a +operational MQTT broker available.

+ +

The draft is ready and working, but I am unsure which LinuxCNC HAL +pins I should collect and publish by default (in other words, the +default set of information pieces published), and how to get the +machine name from the LinuxCNC INI file. The latter is a minor +detail, but I expect it would be useful in a setup with several +machines available. I am hoping for feedback from the experienced +LinuxCNC developers and users, to make the component even better +before it can go into the mainland LinuxCNC code base.

+ +

Since I started on the MQTT component, I came across +another video from Kent +VanderVelden where he combine LinuxCNC with a set of screen glasses +controlled by a Raspberry Pi, and it occured to me that it would +be useful for such use cases if LinuxCNC also provided a REST API for +querying its status. I hope to start on such component once the MQTT +component is working well.

+ +

As usual, if you use Bitcoin and want to show your support of my +activities, please send Bitcoin donations to my address +15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.