Rod,

it is easy to access hal pin from ngc code, if you enable features in 
your INI [RS274NGC] with FEATURES = 12 (enables INI and Hal reading)
And the needed pins can be created in a python handler file. You might 
want to check gmoccapy and gmoccapy_tool_sensor.ini for an example, 
please see also /macros(change.ngc for INI and Hal checking.

Norbert

Am 31.03.2014 17:39, schrieb Rod Fitzsimmons Frey:
> Oh!  But it works now!  I can move the spindle where I want it, I can setp
> on the pins to release the tool, etc. M6T1 does exactly that with this
> code.  I just can't signal to EMC that the tool has been changed, so on the
> *next* call to M6 it reports that the current tool is -1.
>
> But I readily accept that even if it is moving, I *shouldn't* do it this
> way.  I can use the ngc code if necessary, but I couldn't find a way to
> access the signals from my spindle... i went this way so I could create the
> pins I needed to detect if the tool was secure, etc.
>
> The documentation seemed to suggest a full toolchanger could be done with
> only python, I'm just not grokking how to structure that.
>
>
> On Mon, Mar 31, 2014 at 11:30 AM, Michael Haberler <[email protected]>wrote:
>
>> Am 31.03.2014 um 17:15 schrieb Rod Fitzsimmons Frey <[email protected]>:
>>
>>> Thanks!
>>>
>>> .ini file:   http://pastebin.com/VsnQFuzt
>>> .hal file: http://pastebin.com/RHEJYqJB
>>> hal file hook (hal_racktoolchange): http://pastebin.com/njTUZAqS
>>> tool change python code: http://pastebin.com/1EZy0Pur
>> this is a normal userland HAL comp, not embedded in the interpreter
>> you write:
>>
>>          * # These libraries not found - copied from stdglue.py
>>          * import emccanon
>>          * from interpreter import *
>>
>> those are available only _within_ the interpreter, you cannot use them in
>> a normal userland HALcomp
>>
>> oh I see what you are trying to do: interpreter.execute("G53 G1 X%i Y%i
>> F%i" % (x_pos, y_pos, rack_params["Z_RETRACT_SPEED"]))
>>
>> well this will not work (unfortunately), this is the reason:
>>
>> task and motion can handle one running interpreter at a time only; you try
>> to use a second one from outside - even if it were possible to do that, the
>> commands it generated would be ignored because task wouldnt listen to them,
>> it listens only to the interpreter built into milltask
>>
>> so any sequenced move operations involving the interpreter must come from
>> the running program - that was one of the reasons why remapping enables
>> calling on NGC subroutines to do just that
>>
>> sorry, you need to remain with the setup as outlined in the
>> manualtoolchange example; you can replace some ngc by python, but you cant
>> move that code outside the interp into another halcomp
>>
>>
>> - Michael
>>
>>
>>
>>
>>
>>
>>
>>
>>> Console output: http://pastebin.com/jNHZbxAE
>>>
>>>
>>>
>>>
>>> On Mon, Mar 31, 2014 at 10:59 AM, Michael Haberler <[email protected]
>>> wrote:
>>>
>>>> Am 31.03.2014 um 16:03 schrieb Rod Fitzsimmons Frey <[email protected]
>>> :
>>>>> Hey!  After a couple days away I'm back at this.  And immediately
>>>> stalled!
>>>>> :)
>>>>>
>>>>> stdglue.py returns INTERP_ERROR and other constants that I just can't
>>>> seem
>>>>> to locate!  When I try to
>>>>>
>>>>> import emccanon
>>>>> from interpreter import *
>>>>>
>>>>> in my own handler code linuxcnc complains that neither of those modules
>>>> can
>>>>> be found.  I've gone through the source looking for the constants but
>> no
>>>>> luck.
>>>>>
>>>>> Any advice?
>>>>
>>>> yes: please upload your complete configuration, all related files and
>>>> pastebin any error messages
>>>>
>>>> - Michael
>>>>
>>>>
>>>>> On Wed, Mar 26, 2014 at 3:15 PM, Michael Haberler <[email protected]
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>> Am 26.03.2014 um 16:53 schrieb Rod Fitzsimmons Frey <
>> [email protected]
>>>>> :
>>>>>>> Hi!  I'm merrily trying to remap M6 using the guidelines at
>>>>>>>
>> http://linuxcnc.org/docs/devel/html/remap/structure.html#_configuring_iocontrol_with_a_remapped_m6
>>>>>> .
>>>>>>> I'm trying to use all-python to implement my rack toolchanger.
>>>>>>>
>>>>>>> I have some stuff working - change_epilog in stdglue.py is called, my
>>>>>> code
>>>>>>> executes and moves the spindle to the correct location for the new
>>>> tool,
>>>>>>> etc. But change_epilog isn't called.  I put a print statement as the
>>>>>> first
>>>>>>> line in both change_prolog and change_epilog - the former is executed
>>>> but
>>>>>>> the latter is not.
>>>>>>>
>>>>>>> Perhaps as a result of change_epilog not getting called, my current
>>>> tool
>>>>>> is
>>>>>>> never changed from -1.  (Although that could be something else if
>>>>>> there's a
>>>>>>> step I'm missing in my toolchange code.)
>>>>>>>
>>>>>>> My ini file line is
>>>>>>> REMAP=M6 modalgroup=6 prolog=change_prolog epilog=change_epilog
>>>>>>> py=toolchange
>>>>>>>
>>>>>>> and the epilog signature (unchanged from src) is
>>>>>>> def change_epilog(self, **words):
>>>>>>>
>>>>>>> Any advice?
>>>>>> yes
>>>>>>
>>>>>> what you are doing is an all-python remapped code
>>>>>>
>>>>>> now the prolog and epilog Python handlers are there to extract
>>>> parameters,
>>>>>> and set the environment for a _ngc_ remap function
>>>>>>
>>>>>> if you are doing all-python you can collapse all code into a single
>>>> python
>>>>>> remap body (all code will go into py=toolchange)
>>>>>>
>>>>>> so just drop the prolog and epilog handlers, do it all in toolchange()
>>>> and
>>>>>> you should be fine
>>>>>>
>>>>>> there was a problem with three python handlers in sequence; not sure
>> if
>>>> it
>>>>>> is mentioned in the docs or just the code; since the separate pre- and
>>>> post
>>>>>> handlers dont make sense anyway I avoided the issue by not calling
>> them
>>>>>> let me know if you get stuck - just push your config and coce
>> beforehand
>>>>>> so I can have a look
>>>>>>
>>>>>> - Michael
>>>>>>> Thanks!
>>>>>>> Rod
>>>>>>>
>> ------------------------------------------------------------------------------
>>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>>> their
>>>>>>> applications. Written by three acclaimed leaders in the field,
>>>>>>> this first edition is now available. Download your free book today!
>>>>>>> http://p.sf.net/sfu/13534_NeoTech
>>>>>>> _______________________________________________
>>>>>>> Emc-users mailing list
>>>>>>> [email protected]
>>>>>>> https://lists.sourceforge.net/lists/listinfo/emc-users
>>>>>>
>>>>>>
>> ------------------------------------------------------------------------------
>>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>> their
>>>>>> applications. Written by three acclaimed leaders in the field,
>>>>>> this first edition is now available. Download your free book today!
>>>>>> http://p.sf.net/sfu/13534_NeoTech
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>>
>>>>
>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> 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
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> 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
>


------------------------------------------------------------------------------
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to