HAL in Python getprefix() and setprefix() Usage?

More
04 Jan 2016 14:57 #67829 by Simpson36

I still have no idea what you are doing, aside from a passing confused reference to modbus.


Sorry to confuse you.

The reference to Modbus is because that is the problem.

mb2hal automatically creates a bunch of pins . . . which are not accessible in a convenient way in Python, in my opinion.

These and all other pins are easily accessible in BASH . . so it's not impossible, just not integrated into Python at this point in time.

It is what it is. No intension here to criticize LinuxCNC or the forum. I appreciate all the help. ;)

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

More
04 Jan 2016 15:09 #67830 by ArcEye

These and all other pins are easily accessible in BASH . . so it's not impossible, just not integrated into Python at this point in time.


At the risk of repeating myself from your other thread, all the access functions you want exists in python.

There is no bash interface, all you are doing is calling a C program (halcmd) which uses the same C access functions, that the functions in halmodule.cc use.
If you made the same calls using system() in your python code, that would not make it a python interface either.

If you don't understand how to use them, that is a different matter, but first you have to read halmodule.cc, experiment calling the functions to see what results and then frame your question accordingly.

Or, god forbid, share your code so we can see exactly what you are doing and someone might give you a leg up.

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

More
04 Jan 2016 15:09 #67831 by Simpson36
Chris,

Thanks very much for that info. I have LinuxCNC V2.7x.

I was typing "help hal", and not "help(hal)"

Lots of new stuff to learn now, however, a little while ago I found a solution to the loading issue and LinuxCNC is starting up now with the 6 Modbus pins that I need access to via Python nicely created and netted.

I need to move on to other projects, but I plan to revisit this to look ad Glade and I'll research the new stuff you provided here at that time.

THANKS!

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

More
04 Jan 2016 17:04 #67853 by cmorley
happy you found a solution.
It would be good Etiquette and karma to post the solution you found to the problem.
So others who find this post get the solution too.

Chris M

PS dir(hal) could be helpful too

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

More
04 Jan 2016 19:58 - 04 Jan 2016 20:00 #67868 by Simpson36

happy you found a solution.
It would be good Etiquette and karma to post the solution you found to the problem.
So others who find this post get the solution too.

Chris M

PS dir(hal) could be helpful too


Chris,

I posted the solution in the 'main' thread on this issue. This topic was just to ask a specific question about the prefix commands. The solution is in this thread:

forum.linuxcnc.org/forum/38-general-linu...-python-doable/67817

If anyone wants more detail, just let me know. No secrets here, I just think I finally stumbled over the obvious, but am happy to post whatever additional stuff anyone wants. B)
Last edit: 04 Jan 2016 20:00 by Simpson36.

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

More
04 Jan 2016 20:19 #67871 by Simpson36

These and all other pins are easily accessible in BASH . . so it's not impossible, just not integrated into Python at this point in time

There is no bash interface, all you are doing is calling a C program (halcmd) which uses the same C access functions, that the functions in halmodule.cc use.
If you made the same calls using system() in your python code, that would not make it a python interface either..


Not to be argumentative, but while this may be true technically, if a macro begins with /bin/bash and the user is digging thru bash manuals to decipher the bizarre syntax, then it's pretty much bash. Walks like a duck, quacks like a duck, etc. :P

If you don't understand how to use them, that is a different matter, but first you have to read halmodule.cc, experiment calling the functions to see what results and then frame your question accordingly.
Or, god forbid, share your code so we can see exactly what you are doing and someone might give you a leg up.


Can't share what I don't have. Not much point is posting the sample files that are already on linuxcnc.org, and that's all I was using. The project was about 90% completed before I hit the 'Python Barrier', but that was all done with the documented and relatively easy to understand procedures, and that all worked as expected, so no point posting that stuff unless I had in mind to bore you to death. ;) .

OK, seriously, I do very much appreciate everyone who chimed in on this and I look forward to a day when I can return the favor.

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

Time to create page: 0.071 seconds
Powered by Kunena Forum