On Monday 17 April 2017 14:50:41 Chris Morley wrote:

> I think you are using recent master.
>
> If so this python program should give you what you want.
>
> name it metric_status and put it in your $PATH as per:
>
> http://linuxcnc.org/docs/devel/html/hal/halmodule.html
>
> Creating Userspace Python Components -
> LinuxCNC.org<http://linuxcnc.org/docs/devel/html/hal/halmodule.html>
> linuxcnc.org
> A userspace component begins by creating its pins and parameters, then
> enters a loop which will periodically drive all the outputs from the
> inputs.
>
>
>
>
> #!/usr/bin/env python
> import hal
> from hal_glib import GStat
> import gobject
> GSTAT = GStat()
>
> def mode_changed(obj, data):
>         h['g20'] = not data
>         h['g21'] = data
>
> h = hal.component("metric_status")
> h.newpin("g20", hal.HAL_BIT, hal.HAL_OUT)
> h.newpin("g21", hal.HAL_BIT, hal.HAL_OUT)
> h.ready()
>
> GSTAT.connect("metric-mode-changed",mode_changed)
> # work around forced merge error
> GSTAT.merge()
> metric_new = GSTAT.old['metric']
> GSTAT.emit('metric_mode_changed',metric_new)
>
>
> try:
>         gobject.MainLoop().run()
> except KeyboardInterrupt:
>     raise SystemExit
>
>
But I didn't get very far:

pi@raspberrypi:~/linuxcnc/configs/sheldon-lathe $ halrun
halcmd: loadusr metric_status
halcmd: Traceback (most recent call last):
  File "/usr/local/bin/metric_status", line 16, in <module>
    GSTAT.connect("metric-mode-changed",mode_changed)
TypeError: <GStat object at 0x76a9df80 (hal_glib+_GStat at 0xd09500)>: 
unknown signal name: metric-mode-changed

halcmd: show pin
Component Pins:
Owner   Type  Dir         Value  Name

halcmd: 

Something didn't work, but me python dummy.

I thought I was following directions from the link?

Thanks Chris.

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to