________________________________
From: Florian Rist <fr...@fs.tum.de>
Sent: September 20, 2016 8:14 PM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] Accessing a Signal using the Python HAL Interface?
Hi,
thank you all for you help.
> A pin created by a python userspace component can be linked to a signal
> with the "net" command, just like any other HAL pin.
I thought about that, but I could not find 'net' command.
Can this be done from the Python script without calling halcmd?
I just tried this and it worked very well:
h=hal.component("mycomp")
h.newpin("com-pos", hal.HAL_FLOAT, hal.HAL_IN)
h.ready()
msg=Popen('halcmd net emcmot.03.pos-cmd mycomp.com-pos', shell=True,
stdout=PIPE).stdout.read()
h['com-pos'] = newpos
you can make a signal name in python with:
hal.new_sig.(SIGNAME,hal.HAL_PIN_TYPE)
you can connect pin to signal in python with:
hal.connect(PINNAME,SIGNAME)
there are a couple other methods to check for component names and whether a pin
has a writer.
It's in the source - not officially documented.
Pncconf uses these things - or did I mean.
Chris M
------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users
Emc-users Info Page -
SourceForge<https://lists.sourceforge.net/lists/listinfo/emc-users>
lists.sourceforge.net
This list is for users of the Enhanced Machine Controller (EMC). Topics include
how to obtain, install, configure, and use EMC, as well as other general EMC
related ...
------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users