Custom component - addf failed

More
3 years 2 months ago #277370 by zdenek
@Chris I am sorry if I was not clear as to what I thought was wrong. I am not suggesting that something should be loaded automatically. I am saying that the loadrt syntax is unfortunately ambiguous and misleading. I am also quite aware that a lot of LinuxCNC old timers are comfortable with the status quo, hence my initial hesitation to raise this subject.

Please take a moment and read linuxcnc.org/docs/devel/html/hal/comp.html
while trying to put yourself in the shoes of a new user, one who may likely have been exposed to at least a bit of programming.
The document discusses a file name, component, function, and instances -- great but wait a minute, it quickly delves into introducing shortcut macros, special rules, default non-intuitive behavior etc.. By the time you will have read it the first time, you are guaranteed to not remember half of what was said.
My argument is that everything would be much easier if the syntax was a bit less cavalier, adhering to the distinctions between components, functions and instances. It may take a few extra characters to type, but it would eliminate large number of exceptions and rules in the doc above.

That said, and if I wanted to be more formal:

> For understanding, i take and function.
> loadrt and2 count=2 "load realtime function 2 times"

That, strictly speaking, is not an "and2" function. That would be an "and2" component which happens to have a file name that matches the component.

>addf and2.0 servo thread "add the function named and2.0 to the servo thread"

So here "and2" is the component, and .0 is the first instance, but what is the function name? (that's a rhetorical question Mr. Woodcock :-))

I am simply suggesting that in my opinion if all of the special rules and exceptions (e.g., HALLNAME, C name, HAL name... help me jesus) were eliminated, life would be simpler.
Cheers

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

More
3 years 2 months ago #277375 by beefy
Thanks very much for everyone's input.

I'm going back to the drawing board, and going to re-compile on the plasma table PC.

Something I'll do first though is change the name of my component, both inside the comp and the comp name itself.

Holy crap, having a closer look at the docs for writing a component and I've decided to leave underscores and dashes out of the HALNAME. 
Seems underscores are changed to dashes for instance so I'm wondering if that may be my problem.

I'm expecting things are my fault for not looking more closely at the docs for writing a component. I do have to admit I often hate looking at the docs because of the way they are written for non-beginners. Instead I often search the forums for clear cut examples of how things are done, something the docs often severely lack. I often feel like the docs are written to get rid of beginners that are not willing to devote half their life to learning Linuxcnc at a deeper level. I've done some C programming on microcontrollers and only a bit of C# on a PC and been quite successful with my projects, but when I look at the docs I'm often left thinking what the hell does that mean. It's a pity because Linuxcnc seems to be one of the more capable (Qtplasmac is just WOW) and customisable systems out there and I think we'd have a much larger following if it was easier to learn.

I'll report back with how my re-compiling goes.

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

More
3 years 2 months ago #277394 by zdenek
"I do have to admit I often hate looking at the docs because of the way they are written for non-beginners. Instead I often search the forums for clear cut examples of how things are done, something the docs often severely lack. I often feel like the docs are written to get rid of beginners that are not willing to devote half their life to learning Linuxcnc at a deeper level. I've done some C programming on microcontrollers and only a bit of C# on a PC and been quite successful with my projects, but when I look at the docs I'm often left thinking what the hell does that mean. It's a pity because Linuxcnc seems to be one of the more capable (Qtplasmac is just WOW) and customisable systems out there and I think we'd have a much larger following if it was easier to learn."

@beefy That's spot on! I, too, believe that LinuxCNC is quite powerful because it is open source and highly customizable. I would not say the doc is written to "get rid of beginners". To me it looks like it was intended to simplify people's life, but in the process it got out of hand and became too complex to carry out, in the end being what it is today. The docs just attempt to capture what has been done, which in many cases looks quite overwhelming, even for folks with software experience.
But in the end what you are saying is true; it discourages folks from reading the docs -- I am a hard-core software developer with 40+ years of writing OS-level stuff. After I read the doc, like you I decided that I was better off just following code samples rather than trying to remember all of the obscurities. Can't say I am proud of it; if you look at the components I wrote they just follow the pattern I saw working. I have the requisite skills to make it work in other ways, but I didn't think it would have been a good use of my time.

I would love to see the stuff simplified. I would like to see folks like you (with programming background) being excited about being able to create components while understanding what's being done. I recognize that we are talking machine shop crowd here, but I feel that only folks with some programming background will attempt writing components, so I don't buy the argument that dumbing down the API is helpful. As a matter of fact I'd like to suggest that simplifying the API (and the rest of the LinuxCNC ecosystem) would actually attract users.

Cheers
 

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

More
3 years 2 months ago - 3 years 2 months ago #277401 by beefy
@ zdenek

Ha ha, I'm probably over emphasizing my temporary feelings when I say the docs were meant to get rid of beginners.
What I really think is that many hard core programmers, technical people, etc, simply cannot relate to how a beginner will see something they explain. So many things are just second nature to them so they explain things as they see it. A great realisation for them may be to have a relative beginner or even those with some programming experience, proof read their docs, and when the questions follow, it will give them an insight into what's missing for others to make sense of it all.

BACK TO MY ORIGINAL ISSUE:
OK, all seems good now.
I opened up my comp file in Geany on the plasma table PC, and check all line ending were of the Unix type.
Changed the HALNAME from MY_DEMUX_6_64 to MyDemux6to64 so there was no underscores or dashes.
Likewise named the comp file to MyDemux6to64.comp.
Used Halcompile on the plasma table PC to compile the file, and it installed the compiled .so file in the modules directory with all the other hal components.
After that part of the hal file seemed to pass over without errors so I'm assuming all good there.

Qtplasmac did not completely start up but that's because of another issue in the hal file which says my ilowpass.0.in pin does not exist. Working on sorting that out now.

Thanks to everyone for the help
Last edit: 3 years 2 months ago by beefy.

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

More
3 years 2 months ago #277402 by zdenek
@beefy Thank you for your thoughtful observations and great suggestions. Hopefully one day we'll get there. Glad you figured it out!
Cheers

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

More
3 years 2 months ago - 3 years 2 months ago #277410 by beefy
No probs Zdenek.

I also managed to fix the ilowpass issue, but no great suggestions to offer on that one. I'd had a dumb arse moment, and had it commented out in the hal file LOL.
Last edit: 3 years 2 months ago by beefy.

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

Time to create page: 0.068 seconds
Powered by Kunena Forum