LinuxCNC interaction with QT application

More
19 Feb 2022 13:15 #235326 by Guglielmi
Hello,
I would like to use LinuxCNC for my CNC and I'm thinking to install it on RPI4, I tested and it seems working fine. (it seems.. --> I didn't checked all feature, just if I'm able to provide a step/dir through GPIO ).
Well, not I would like to do an additional step, creating a QT small application that it has the task to control somethings, let me say, advanced on my CNC, like some temperature for motors, sensors for water cooling circuit, etc.. so basically a list of sensor I'm able to collect in my Raspberry but not directly through GPIO but for example through serial communication etc.. Ah, I forgot! The spindle it's a huge additional thing I want to control in my app with Modbus. So, parameter setup, diagnostic speed..  
Ok, finally the question:
there is a way to interact with LinuxCNC? Do I need a special driver? I know for example the way to share memory but I don't have idea how to extract information inside LinuxCNC, by best target is for example to add a label on HMI to show motor temperature, or actual speed..
There is someone that already did something similar?

Thanks a lot
Andrea

Please Log in or Create an account to join the conversation.

More
20 Feb 2022 19:19 #235411 by Grotius
Hi,

On github there are several examples to be found.

This is a old example, not up to date, it contains nml a overflow bug, but it tell's you the basics how to interact.
Here are more advanched examples how to interact.

Do I need a special driver?
If you code in C or C++ you can code straight to the finish line by including lcnc's libs to your qt project.

I know for example the way to share memory
That's nice. When coding for lcnc in C or C++, you can allocate memory by special hal functions. These hal functions
will create hal memory space for you.

by best target is for example to add a label on HMI to show motor temperature, or actual speed..
Yes, that is a nice starting point. Maybe you can strip down the first link. And try it step by step.
For reference you could look in the next link how some hal things are done.

Good luck !




 
The following user(s) said Thank You: Guglielmi

Please Log in or Create an account to join the conversation.

More
21 Feb 2022 07:29 #235445 by Guglielmi
Thanks for really precise notes, I will try following your suggestions.
I appreciated a lot.
I leave open this loop in case I have details that make sense to ask.
Bye

Please Log in or Create an account to join the conversation.

More
11 Jul 2022 06:33 #247058 by udoS
Hi Grotius
How/where could you find the number of joints and axis like in the ini file.
XYZY
joints = 4;

XYYZ
joints = 4;
How to get that info programmatically from within Qt;
Only from the Qt/c++; I don't want to read the .ini file.

Best Regards

Please Log in or Create an account to join the conversation.

More
16 Jul 2022 11:14 #247447 by andypugh

How to get that info programmatically from within Qt;
Only from the Qt/c++; I don't want to read the .ini file.

I think you should read the INI file. There are library functions for the job, and that is the source of much of the infomation that the GUIs use. 

Typical usage
#include "emcIniFile.hh"
...
EmcIniFile *inifile
...
if inifile.open(filename) < 0 ........
...
int num_joints;
inifile->Find(&num_joints, "TRAJ", "JOINTS");

Please Log in or Create an account to join the conversation.

More
17 Jul 2022 08:25 #247544 by udoS
@andypugh ...

Thank you, yes that one I found already;
Now, since I use Qt, I also can use QSettings to read the .ini key, value pairs directly;

Best Regards
udoS


 

Please Log in or Create an account to join the conversation.

Time to create page: 0.300 seconds
Powered by Kunena Forum