keystroke as a hal pin?

More
11 years 4 weeks ago #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

Please Log in to join the conversation.

More
11 years 4 weeks ago #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

Please Log in to join the conversation.

More
11 years 4 weeks ago #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...

Please Log in to join the conversation.

More
11 years 4 weeks ago #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

Please Log in to join the conversation.

More
11 years 4 weeks ago #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:
Code:
[DISPLAY] USER_COMMAND_FILE = keystroke.py

and the keystroke.py contains this code:
Code:
root_window.bind("<KeyPress-j>",commands.send_mdi )


so, at this point, if I have some mdi command on the "buffer"

Attachment not found



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 to join the conversation.

More
11 years 3 weeks ago #63490 by andypugh
Replied by andypugh on topic keystroke as a hal pin?

jtc wrote: 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 to join the conversation.

More
11 years 3 weeks ago #63514 by jtc
Replied by jtc on topic keystroke as a hal pin?

andypugh wrote:

jtc wrote: 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:
Code:
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:
Code:
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

Please Log in to join the conversation.

More
11 years 3 weeks ago #63522 by andypugh
Replied by andypugh on topic keystroke as a hal pin?

jtc wrote: 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 to join the conversation.

More
11 years 3 weeks ago #63531 by ArcEye
Replied by ArcEye on topic keystroke as a hal pin?

jtc wrote: 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 to join the conversation.

More
11 years 3 weeks ago #63537 by jtc
Replied by jtc on topic keystroke as a hal pin?
I will see it.

Thanks

Please Log in to join the conversation.

Time to create page: 0.103 seconds
Powered by Kunena Forum