How to loadrt multiple places with additional instances lk machinekit instcomp

More
25 Feb 2022 17:24 #235803 by yeltrow
Does anyone have any workarounds for getting multiple loadrt lines in .hal files so they do not conflict when they need the same modules? Machinekit has a workaround called instcomp which allows additional instances of a component to be incrementally added later.  www.machinekit.io/docs/hal/instcomp/

I would like to have the various hal files for my machine load their module dependencies and names on their own without crashing because the modules are already loaded.  This is for the goal of code abstraction and configuration file reuse.  It comes up in the context of me wanting to migrate my machine configuration from a parallel port configuration to a Mesa 7i76e and undoing the decade of config file sins I have committed (via git at github.com/yeltrow/theshiz

I know I can put:
loadrt sum2 names=snazzysummer,dumbfilesummer
but that doesn't achieve a level of abstraction that could be useful.  When do I see wanting that? To make things like PNCConf spit out a base set of definitions for things like pid loops that I can just add my configs to instead of needing go back and hand edit them. 

for example in

#somethingsnazzy.hal
loadrt sum2 names=snazzysummer

#dumbfile.hal
loadrt sum2 names=dumbfilesummer

and then in mymachine.ini

[HAL]
HALFILE = somethingsnazzy.hal
HALFILE = dumbfile.hal

Maybe some sort of pre-processor? 

Thank you very much for your thoughts.  I really appreciate it!
 

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

More
25 Feb 2022 17:45 #235807 by Aciera
The following user(s) said Thank You: yeltrow

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

More
25 Feb 2022 18:15 #235810 by yeltrow
Brilliant! Thank you so much. The caveats are perhaps a little dicey, but that should enable the abstraction I'm looking for.

I wonder if it is crazy to implement and architectural change where linuxcnc always renames copies of the modules it inserts into the kernel so there aren't conflicts? I know that means more kernel memory due to unnecessary copies, but memory is kinda cheap these days. (like modprobe -o? )

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

Time to create page: 0.068 seconds
Powered by Kunena Forum