Does anyone have a good idea to modify HAL?
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.
- Mike_Eitel
- Offline
- Platinum Member
- Posts: 1150
- Thank you received: 184
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.
- tommylight
- Away
- Moderator
- Posts: 19209
- Thank you received: 6438
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.
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.
Could you be more specific what you mean by this?I hope hal can have its own simple compilation environment[...]
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.)Also need to add function code area, global variables, if condition judgment, etc.
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)?[...]include module instantiation, variables and module pointers, module variables have a fixed area[...]
Also, there is no real-time memory allocator, as far as I know, so fixed area for module variables will probably not change.
Thanks.
Please Log in or Create an account to join the conversation.
- Mike_Eitel
- Offline
- Platinum Member
- Posts: 1150
- Thank you received: 184
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
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
- Posts: 19209
- Thank you received: 6438
Please Log in or Create an account to join the conversation.
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.
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.
Please Log in or Create an account to join the conversation.
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
Please Log in or Create an account to join the conversation.