LinuxCNC for automation
- tdon
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
28 Jul 2020 08:29 #176227
by tdon
LinuxCNC for automation was created by tdon
Hello,
I'm new to LinuxCNC and I've got a general question:
I want to control a machine using Linux. It consists of several motors that need to be controlled depending on measured values from different sensors. It would be nice to put the program structure in C/C++-Code and not G-Code. Furthermore I would prefer ton use Mesa-Cards as an interface to the hardware. Is it possible to do this with LinuxCNC or is there a better way/tool?
Thanks for your help!
Best regards,
Tobias
I'm new to LinuxCNC and I've got a general question:
I want to control a machine using Linux. It consists of several motors that need to be controlled depending on measured values from different sensors. It would be nice to put the program structure in C/C++-Code and not G-Code. Furthermore I would prefer ton use Mesa-Cards as an interface to the hardware. Is it possible to do this with LinuxCNC or is there a better way/tool?
Thanks for your help!
Best regards,
Tobias
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23178
- Thank you received: 4861
28 Jul 2020 13:17 #176243
by andypugh
Yes, that is all very possible with LinuxCNC. In fact for such a job LinuxCNC would be _my_ first choice, but then if your only tool is a hammer....
If you are not already familiar with LinuxCNC then it might not be the best choice for you.
LinuxCNC can run happily without G-code. It is quite common to make a custom GUI that operates on the HAL level (generally using Python code, but I think that C++ and QT is an option). There is also a built-in PLC (classic ladder) and you can write standalone HAL components in a C-like language called .comp.
What sorts of sensors are being used?
Replied by andypugh on topic LinuxCNC for automation
I'm new to LinuxCNC and I've got a general question:
I want to control a machine using Linux. It consists of several motors that need to be controlled depending on measured values from different sensors. It would be nice to put the program structure in C/C++-Code and not G-Code. Furthermore I would prefer ton use Mesa-Cards as an interface to the hardware. Is it possible to do this with LinuxCNC or is there a better way/tool?
Yes, that is all very possible with LinuxCNC. In fact for such a job LinuxCNC would be _my_ first choice, but then if your only tool is a hammer....
If you are not already familiar with LinuxCNC then it might not be the best choice for you.
LinuxCNC can run happily without G-code. It is quite common to make a custom GUI that operates on the HAL level (generally using Python code, but I think that C++ and QT is an option). There is also a built-in PLC (classic ladder) and you can write standalone HAL components in a C-like language called .comp.
What sorts of sensors are being used?
Please Log in or Create an account to join the conversation.
- tdon
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
29 Jul 2020 08:49 #176342
by tdon
Replied by tdon on topic LinuxCNC for automation
Thank you for all the information! That's exactly what I was searching for.
Most of the sensors deliver a 0-10V signal (strain gauges, temperatures,...) and I have one rotary encoder.
Is there any example how to build a GUI operation on HAL level with C++/QT? Thanks!
Most of the sensors deliver a 0-10V signal (strain gauges, temperatures,...) and I have one rotary encoder.
Is there any example how to build a GUI operation on HAL level with C++/QT? Thanks!
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23178
- Thank you received: 4861
29 Jul 2020 10:36 #176346
by andypugh
There are SPI A/D cards available cheaply, search eBay for ADS1256 (I _think_ that the unpopulated spaces on the boards are for potential divider resistors to handle higher voltages.) You might have to bit-bang the SPI interface, though.
For a more ready-to-run solution, there is the Mesa 7i87 (But note that requires an FPGA card and an interface adaptor card, (combined in one on the 7i94, or as two cards such as 7i64 and 7i44) and I think that General Mechatronics have modules too.
But if youa re prepared to use Python in the back-end then that is a more-travelled path.
Replied by andypugh on topic LinuxCNC for automation
Thank you for all the information! That's exactly what I was searching for.
Most of the sensors deliver a 0-10V signal (strain gauges, temperatures,...) and I have one rotary encoder.
There are SPI A/D cards available cheaply, search eBay for ADS1256 (I _think_ that the unpopulated spaces on the boards are for potential divider resistors to handle higher voltages.) You might have to bit-bang the SPI interface, though.
For a more ready-to-run solution, there is the Mesa 7i87 (But note that requires an FPGA card and an interface adaptor card, (combined in one on the 7i94, or as two cards such as 7i64 and 7i44) and I think that General Mechatronics have modules too.
Have a look at forum.linuxcnc.org/41-guis/36768-qt-c-code-samplesIs there any example how to build a GUI operation on HAL level with C++/QT? Thanks!
But if youa re prepared to use Python in the back-end then that is a more-travelled path.
Please Log in or Create an account to join the conversation.
- tdon
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
29 Jul 2020 12:43 #176382
by tdon
Replied by tdon on topic LinuxCNC for automation
Many thanks for your help! I really appreciate it!
Please Log in or Create an account to join the conversation.
- Grotius
- Offline
- Platinum Member
Less
More
- Posts: 2254
- Thank you received: 1995
03 Aug 2020 21:04 - 03 Aug 2020 21:06 #177093
by Grotius
Replied by Grotius on topic LinuxCNC for automation
Last edit: 03 Aug 2020 21:06 by Grotius.
The following user(s) said Thank You: tommylight, tdon
Please Log in or Create an account to join the conversation.
- tdon
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
04 Aug 2020 06:15 #177179
by tdon
Replied by tdon on topic LinuxCNC for automation
Thank you very much! That helps a lot and is exactly what I was search for.
This forum is great!
This forum is great!
Please Log in or Create an account to join the conversation.
- Grotius
- Offline
- Platinum Member
Less
More
- Posts: 2254
- Thank you received: 1995
05 Aug 2020 00:50 #177324
by Grotius
Replied by Grotius on topic LinuxCNC for automation
Please Log in or Create an account to join the conversation.
- Himarc3D
- Offline
- Premium Member
Less
More
- Posts: 119
- Thank you received: 49
05 Aug 2020 03:33 #177340
by Himarc3D
Hey, Grotius.
Can you recommend some tutorial, book, documentation to learn QT with C++?
Thank you
Replied by Himarc3D on topic LinuxCNC for automation
Today did some work on the opengl, source code attached.
The toolpath preview (simulator) is doing a very nice job so far.
For gcode preview i have to write some extra code.
Hey, Grotius.
Can you recommend some tutorial, book, documentation to learn QT with C++?
Thank you
Please Log in or Create an account to join the conversation.
- Grotius
- Offline
- Platinum Member
Less
More
- Posts: 2254
- Thank you received: 1995
05 Aug 2020 21:36 - 05 Aug 2020 21:50 #177425
by Grotius
Replied by Grotius on topic LinuxCNC for automation
Hi Himarc,
The buckie videos on youtube are nice to follow.
If you compare buckies examples to my code style, you will see i use header only if possible.
Most of time i use a header file to do calculation's instead of a class wich contains a .h and .cpp file.
Private, public and so on don't interest me. The only thing that interest me is a compact program that does the job.
The downside of header only is, sometimes you cannot include a header twice in the same program.
Qt, look at : refractor -> rename under cursor
Qt, auto indent selection
For documentation i learned to use the standard c++ library (std) as much as possible. So when i can avoid a qt library i do so to
make program's more cross platform compatible.
If i need to know something about c++ i google for a example.
Good luck. What will you write for a program, will it contain a graphical interface with opengl?
The buckie videos on youtube are nice to follow.
If you compare buckies examples to my code style, you will see i use header only if possible.
Most of time i use a header file to do calculation's instead of a class wich contains a .h and .cpp file.
Private, public and so on don't interest me. The only thing that interest me is a compact program that does the job.
The downside of header only is, sometimes you cannot include a header twice in the same program.
Qt, look at : refractor -> rename under cursor
Qt, auto indent selection
For documentation i learned to use the standard c++ library (std) as much as possible. So when i can avoid a qt library i do so to
make program's more cross platform compatible.
If i need to know something about c++ i google for a example.
Warning: Spoiler!
try to use :
std::string, double, int, bool, char, etc.
Things that are handy to use, for example :
abs or -abs
if(101%2==0){ .. } //to compare if value 101 is even or uneven.
Things to know are container types like vector :
std::vector<double>
I stay at vectors. I do not use any of the qt container types, like stringlist, linked list etc.
setting up structures and how to use them in functions :
struct POINT {
double x,y,z;
}
standard function :
void test(){
//do things here.
}
try to understand a function to return the point value.
POINT test(){
POINT p;
p.x=1;
return p;
}
read in the point done by above function:
void read_in(){
POINT point = test();
}
pass in values :
void test (double x, double y, double z, /*or simpler x,y,z in one point :*/ POINT p){
//here you see we pass in x,y,z or we pass in a point p.x, p.y, p.z wich is easyer and less work.
}
you can pass in iterators (kind of pointers)
void test (std::vector<POINT>::iterator it){
//how to use this you will learn by practicing and look at iterator code samples.
}
std::string, double, int, bool, char, etc.
Things that are handy to use, for example :
abs or -abs
if(101%2==0){ .. } //to compare if value 101 is even or uneven.
Things to know are container types like vector :
std::vector<double>
I stay at vectors. I do not use any of the qt container types, like stringlist, linked list etc.
setting up structures and how to use them in functions :
struct POINT {
double x,y,z;
}
standard function :
void test(){
//do things here.
}
try to understand a function to return the point value.
POINT test(){
POINT p;
p.x=1;
return p;
}
read in the point done by above function:
void read_in(){
POINT point = test();
}
pass in values :
void test (double x, double y, double z, /*or simpler x,y,z in one point :*/ POINT p){
//here you see we pass in x,y,z or we pass in a point p.x, p.y, p.z wich is easyer and less work.
}
you can pass in iterators (kind of pointers)
void test (std::vector<POINT>::iterator it){
//how to use this you will learn by practicing and look at iterator code samples.
}
Good luck. What will you write for a program, will it contain a graphical interface with opengl?
Last edit: 05 Aug 2020 21:50 by Grotius.
Please Log in or Create an account to join the conversation.
Time to create page: 0.100 seconds