Wow, this is frustrating. :)

I can create HAL pins just fine, and wire them up with signals just-so.  I
can watch them turn on and off at appropriate times with halscope, etc.

BUT I can't access them anywhere from code! The remap code for M6 has the
hal python component, but:

1. If I try to create the hal component (mine is called
"hal_racktoolchange") it fails, since the constructor hal.component(name)
CREATES the component.  The call fails in the remap because the component
already exists
2. I can't simply ACCESS the component - only create it.
3. I can't access any pins without having a component - I've been through
all the python and C++ code trying to find a way, but nadda.
4. I've tried bridging creation and access by using an intermediate python
class that creates the pins and stores them as a global.  But when I access
that class from the remapping code, it's entirely uninitialized - must be
in a completely separate python interpreter.

Without having a Hal "component" class instance, I'm basically hamstrung,
and there is no way I can find to get an already-existing component.

I really have to give up and fall back on the O codes.  But I'm left really
not understanding why there is any Python interpreter available at all -
you don't seem to be able to do anything with it, nothing that isn't
trivial anyhow.

Although I remain convinced there's a way - after all, the code that
interprets the O code subroutines can do it with the #<_hal[HalItem]>
syntax. I haven't been able to find the code that interprets those
subroutines though.




On Mon, Mar 31, 2014 at 5:40 PM, andy pugh <[email protected]> wrote:

> On 31 March 2014 22:13, Rod Fitzsimmons Frey <[email protected]> wrote:
>
> > Everything's working great, I'm just getting hung up on communicating
> with
> > them from the python remap code. Looks like the suggestion of mapping to
> > M64 commands is the way to go, although it seems a bit unsatisfying.  I
> was
> > really trying to do things in the most general way and the python
> remapping
> > seems like a wonderful avenue.
>
> You can import "hal" into your Python and create HAL pins from your
> code to connect to other HAL pins.
>
> It might even be possible to set hal pins from Python without
> exporting pins, I can see a set_p function in help("hal")
>
> However, I think that exporting pins to HAL is the "right" way, rather
> than hard-coding links in the software.
>
> --
> atp
> If you can't fix it, you don't own it.
> http://www.ifixit.com/Manifesto
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Emc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to