Does anyone have a good idea to modify HAL?

More
04 Aug 2020 09:53 #177206 by Gorgc
i used to work on codesys, and I found that it has many similar ideas to linuxcnc hal. well, the code of codesys is much stronger, even if it is closed source, from its oem code, the organization is much stronger than that of hal. But hal can already be regarded as a good iec prototype.


I hope hal can have its own simple compilation environment to do some industrial process control. Also need to add function code area, global variables, if condition judgment, etc. Other modifications include module instantiation, variables and module pointers, module variables have a fixed area (input and output are no longer connected by pointers).

I want to know what hal has in-depth plans? Or has someone made some stronger mods?

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

More
04 Aug 2020 12:23 #177226 by Mike_Eitel
Sorry if i might offend you, but
I'd say i know codesys since a while (ca since 97) and was quite involved. And I totaly dissagree with your opinion of similarity to hal. But there is an easy free solution:

www.openplcproject.com/ They even have a nice modbus/tcp io module implementation for esp's.

Mike

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

More
04 Aug 2020 13:27 #177243 by tommylight
I never used Codesys, but jumping to conclusions is never a good idea.
From that title, what would be a "good idea" ?
Hal is very versatile and can be modified extensively, CNC IS and industrial process control, so yes it can do industrial process control, and LinuxCNC has a compilation "environment" for compiling real time components, if any already does not exist.
You could start here :
linuxcnc.org/docs/html/hal/components.html
LinuxCNC also has Classic Ladder if you are more familiar with PLC.

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

More
04 Aug 2020 13:43 #177244 by cmorley
Machinekit has extended HAL to include mutiiple instantiation of a module, among other things.
I know of no plans to expand linuxcnc's HAL in the future.

Chris

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

More
04 Aug 2020 13:59 - 04 Aug 2020 14:01 #177247 by Cerna
Hmm, I don't know CODESYS, but at first glance at the website www.codesys.com it certainly does share similarities.

I hope hal can have its own simple compilation environment[...]

Could you be more specific what you mean by this?

Also need to add function code area, global variables, if condition judgment, etc.

I would say that all this is in current implementation of HAL. Global variables are in terms of HAL shared memory segment the HAL Pins, conditions can be had in HAL functions which are run as a part of main loop. (I don't know what to image under the add function code area.)

[...]include module instantiation, variables and module pointers, module variables have a fixed area[...]

LinuxCNC's HAL doesn't have instantiation (and probably never will), variables are HAL Pins. Could you specify what you mean by module pointers (how it could be used)?

Also, there is no real-time memory allocator, as far as I know, so fixed area for module variables will probably not change.

Thanks.
Last edit: 04 Aug 2020 14:01 by Cerna.

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

More
04 Aug 2020 15:02 #177250 by Mike_Eitel
Hi Tommy
I saw you discussing to touch a huge machining installation with 28 plc's. So i guessed you know a bit about codesys. This is probably the widest spread plattform of IEC 61131. If you do not go to a few suppliers like Siemens, B&R,.. it is the defacto plattform of coding serious plc's. Since some years (never tried it) it even includes some motion parts (a bit cnc). And since a few years they made the clever jump to support rpi, bbb. You pay low price for runtime systems on those, declaredas non proffesional, devices. 50-90€.
Mike
The following user(s) said Thank You: tommylight

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

More
04 Aug 2020 17:51 #177263 by tommylight
Thank you Mike, for now i am staying away from it, and anything proprietary.

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

More
05 Aug 2020 01:12 #177327 by Gorgc
linuxcnc is a serious project, codesys is even more. I spent a long time trying to figure out how codesys did it. I don't want to make that perfect, nor do I want to make a complete iec environment, but I do want to make a real-time system that is rigorous, convenient, and extendable. It didn't seem feasible until I saw the hal code. I realize that after some modifications, it may be able to implement part of the codesys functions in the current way, so that industrial automation engineers can easily complete their work.
I'm actually saying that the current linuxcnc can't do this well. Maybe this is too offensive. My job is to get a project that uses linuxcnc out of trouble. It has been in development for 4 years, and now it can neither make it easy for software engineers to debug, nor can it be used by automation engineers. Maybe the problem is the engineer: D
I once set up an industrial robot project on codesys, and I remember how easy it is. And I know that one of Beckhoff’s brothers spent many years and didn’t make it. Codesys' cnc and robot are like a bunch of toys. If the business code has been done very maturely, then only the real-time thread of codesys and the ethercat master are needed to make a very simple and stable cnc project. Even these business codes can be written in IEC's ST language, which is even more convenient to debug. But I believe linuxcnc and HAL can do this.

Since I still need to use linuxcnc now, I am going to implement another layer above the HAL layer, using the real-time thread of hal to implement control modules and connect them, but the modules and variables need to have the characteristics I mentioned before (this is the key , Please point out if you have different opinions). This is my plan. I don't think I can do better, with me alone in such a short time, but I will start to do it. This is my job after all. I don't want to offend so many outstanding engineers who have contributed a lot to this project by saying these things. Sorry if so. But I do want to see if you have more ideas.

Sorry that my English is not very good, so I have to use translation tools. If anyone is interested, I am willing to share more of my views

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

More
05 Aug 2020 01:13 #177328 by Grotius
Hi

i used to work on codesys, and I found that it has many similar ideas to linuxcnc hal. well, the code of codesys is much stronger, even if it is closed source, from its oem code, the organization is much stronger than that of hal. But hal can already be regarded as a good iec prototype.

I know software types like codesys. But have no experience with codesys so far.

I hope hal can have its own simple compilation environment to do some industrial process control. Also need to add function code area, global variables, if condition judgment, etc. Other modifications include module instantiation, variables and module pointers, module variables have a fixed area (input and output are no longer connected by pointers).
I want to know what hal has in-depth plans? Or has someone made some stronger mods?


Here you got my attention.
My plan is to build a new hal enviroment sooner or later.
It will get building blocks for ethercat control, steppers, kinematics, variables, i/o, etc, etc.
Can be programmed at user level with low level commands, but has to be compiled.
The following user(s) said Thank You: Gorgc

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

More
05 Aug 2020 01:56 - 05 Aug 2020 06:02 #177334 by Gorgc
hi Cerna:
In my idea, the new logic control layer also includes a data area, which stores the data of the instantiated module(means there might be many instance of a module, and you need to handle each by their own name) and global variables. I don’t like using pointers for input and output. I hope that each module will allocate space in the data area after instantiation (including input output inout and local variables). Modules have their own functions(still not decided whether functions have parameters). Because the relationship between the control modules is very close, for example, a robot module must be connected to a kinematic module, several Axis module, axis module is connected to one or two servo modules, and each servo is connected to a motor module. In fact, there are very few types of robots or cnc modules, no more than 100.some modules have pvoid variables pointed to another module,in order to call another module’s local functions by themselves. For module designers, he could use another module’s header to know others variables or functions. I think this should be used for inter-module communication.

I think a fixed code area is needed to store functions, mainly for adding compilers in the future. The current function call method is ok, if I understand it correctly, it depends on the function chain in a thread. In other words, the process depends on this chain, but there are only functions of each module in the chain (please correct me if it is wrong, thx). you cant just do operation like robot.x=axis1.pos. I think it is better to add a single main function directly to the thread, which has already been compiled. so a compiler is needed.

More ideas are still being designed. The way i think each function or module should be designed is that they all all functions that returns void, and the parameter has only one pvoid pointing to the parameter structure actually used. Then they could be complied in file or just put the code into code area. Global functions and main programs are placed in the code area for calling

Just some ideas that are just beginning to be realized. Please correct me if there is an error
Last edit: 05 Aug 2020 06:02 by Gorgc.

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

Time to create page: 0.189 seconds
Powered by Kunena Forum