keystroke as a hal pin?
01 Oct 2015 19:12 #63325
by jtc
keystroke as a hal pin? was created by jtc
Hi,
I'm wondering if is possible to assign a keyboard keystroke as an HAL pin? My objective is to use 3 keys, witch one will call a subroutine.
the first will open a log file, the second to log the X and Y coordinates, and finally the third to close the log file. If I can use this with the present keyboard keys it will be great.
Thanks
I'm wondering if is possible to assign a keyboard keystroke as an HAL pin? My objective is to use 3 keys, witch one will call a subroutine.
the first will open a log file, the second to log the X and Y coordinates, and finally the third to close the log file. If I can use this with the present keyboard keys it will be great.
Thanks
Please Log in or Create an account to join the conversation.
01 Oct 2015 19:32 #63326
by cmorley
Replied by cmorley on topic keystroke as a hal pin?
What screen are you using?
Gmoccapy or Gscreen are easier to add this to then AXIS
Chris M
Gmoccapy or Gscreen are easier to add this to then AXIS
Chris M
Please Log in or Create an account to join the conversation.
01 Oct 2015 19:36 #63327
by jtc
Replied by jtc on topic keystroke as a hal pin?
I'm using Axis screen.
I prefer a solution that don't depends on the screen. The machine has already a custom panel on axis, and do the complete migration will involve some work...
I prefer a solution that don't depends on the screen. The machine has already a custom panel on axis, and do the complete migration will involve some work...
Please Log in or Create an account to join the conversation.
01 Oct 2015 19:55 #63329
by cmorley
Replied by cmorley on topic keystroke as a hal pin?
The solution will always depend on the screen, if you wish to use the standard keyboard.
If you wish to use some other external buttons then it can be outside of the running screen.
That being said it is not impossible with AXIS it's just not many people know it well enough - including me.
Chris M
If you wish to use some other external buttons then it can be outside of the running screen.
That being said it is not impossible with AXIS it's just not many people know it well enough - including me.
Chris M
Please Log in or Create an account to join the conversation.
02 Oct 2015 05:10 #63352
by jtc
Replied by jtc on topic keystroke as a hal pin?
with thios post help :
www.linuxcnc.org/index.php/english/forum...gging?start=10#62208
and seeing the axis.py file
I add to my ini file configuration on the display area:
and the keystroke.py contains this code:
so, at this point, if I have some mdi command on the "buffer"
but I cant find any "commands.send_mdi" that have a string as an argument. or a way to write on the "buffer".
João
www.linuxcnc.org/index.php/english/forum...gging?start=10#62208
and seeing the axis.py file
I add to my ini file configuration on the display area:
[DISPLAY]
USER_COMMAND_FILE = keystroke.py
and the keystroke.py contains this code:
root_window.bind("<KeyPress-j>",commands.send_mdi )
so, at this point, if I have some mdi command on the "buffer"
but I cant find any "commands.send_mdi" that have a string as an argument. or a way to write on the "buffer".
João
Please Log in or Create an account to join the conversation.
06 Oct 2015 19:33 #63490
by andypugh
Does this help?
www.linuxcnc.org/docs/html/config/python-interface.html
Replied by andypugh on topic keystroke as a hal pin?
but I cant find any "commands.send_mdi" that have a string as an argument. or a way to write on the "buffer".
Does this help?
www.linuxcnc.org/docs/html/config/python-interface.html
Please Log in or Create an account to join the conversation.
07 Oct 2015 02:14 - 07 Oct 2015 02:18 #63514
by jtc
I already had seen this link, I tryed to use the following code on my .py file:
hopping to see to be executed on simulation, but without success.
regarding the original idea of the topic, using a keystroke as an hal pin, in axis.py file, next to line 3226 I find this:
that create the axisui pins, but if I changed the name of one of these pins, when start linuxcnc I can´t see any difference in axisui pin names.
So, I'm missing something...
João
Replied by jtc on topic keystroke as a hal pin?
but I cant find any "commands.send_mdi" that have a string as an argument. or a way to write on the "buffer".
Does this help?
www.linuxcnc.org/docs/html/config/python-interface.html
I already had seen this link, I tryed to use the following code on my .py file:
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
def ok_for_mdi():
s.poll()
return not s.estop and s.enabled and s.homed and (s.interp_state == linuxcnc.INTERP_IDLE)
if ok_for_mdi():
c.mode(linuxcnc.MODE_MDI)
c.wait_complete() # wait until mode switch executed
c.mdi("G0 X10 Y20 Z30")
hopping to see to be executed on simulation, but without success.
regarding the original idea of the topic, using a keystroke as an hal pin, in axis.py file, next to line 3226 I find this:
if hal_present == 1 :
comp = hal.component("axisui")
comp.newpin("jog.x", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.y", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.z", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.a", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.b", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.c", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.u", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.v", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.w", hal.HAL_BIT, hal.HAL_OUT)
comp.newpin("jog.increment", hal.HAL_FLOAT, hal.HAL_OUT)
comp.newpin("notifications-clear",hal.HAL_BIT,hal.HAL_IN)
comp.newpin("notifications-clear-info",hal.HAL_BIT,hal.HAL_IN)
comp.newpin("notifications-clear-error",hal.HAL_BIT,hal.HAL_IN)
comp.newpin("resume-inhibit",hal.HAL_BIT,hal.HAL_IN)
that create the axisui pins, but if I changed the name of one of these pins, when start linuxcnc I can´t see any difference in axisui pin names.
So, I'm missing something...
João
Last edit: 07 Oct 2015 02:18 by jtc.
Please Log in or Create an account to join the conversation.
07 Oct 2015 05:33 #63522
by andypugh
That ought to work, it normally does.
Replied by andypugh on topic keystroke as a hal pin?
if ok_for_mdi():
c.mode(linuxcnc.MODE_MDI)
c.wait_complete() # wait until mode switch executed
c.mdi("G0 X10 Y20 Z30")[/code]
That ought to work, it normally does.
Please Log in or Create an account to join the conversation.
07 Oct 2015 16:29 #63531
by ArcEye
It is already available as standard in Machinekit, with modifications I added some while ago.
You can assign 10 commands, MDI, HAL or system to the 0 - 9 number keys
See mgware.co.uk/ > Axis Modifications > User Defined Commands to read the details and download the zip.
I have not bothered keeping it current with Linuxcnc versions, but the code should be pretty much unchanged.
regards
Replied by ArcEye on topic keystroke as a hal pin?
Hi,
I'm wondering if is possible to assign a keyboard keystroke as an HAL pin? My objective is to use 3 keys, witch one will call a subroutine.
the first will open a log file, the second to log the X and Y coordinates, and finally the third to close the log file. If I can use this with the present keyboard keys it will be great.
Thanks
It is already available as standard in Machinekit, with modifications I added some while ago.
You can assign 10 commands, MDI, HAL or system to the 0 - 9 number keys
See mgware.co.uk/ > Axis Modifications > User Defined Commands to read the details and download the zip.
I have not bothered keeping it current with Linuxcnc versions, but the code should be pretty much unchanged.
regards
Please Log in or Create an account to join the conversation.
07 Oct 2015 19:04 #63537
by jtc
Replied by jtc on topic keystroke as a hal pin?
I will see it.
Thanks
Thanks
Please Log in or Create an account to join the conversation.
Time to create page: 0.098 seconds