- Posts: 60
- Thank you received: 0
Is there a way to touch-off purely in HAL?
- chowderhead
- Topic Author
- Offline
- Senior Member
-
Less
More
2 years 7 months ago #295423
by chowderhead
Is there a way to touch-off purely in HAL? was created by chowderhead
I'm writing a python HAL component that includes touching off and want to avoid importing linuxcnc and firing an mdi command if possible. Is there any way to do it using only HAL?
Please Log in to join the conversation.
2 years 7 months ago #295426
by Mecanix
Replied by Mecanix on topic Is there a way to touch-off purely in HAL?
Mind you I have no idea what you're trying to achieve. Until we've figured that part out, try that just for fun:
1. Create a new file, call it "whatever.py"
2. Copy below code in it. Save it into your ~/chowderhead/
3. Start Axis, Un-stop & En it, home all.
4. Start terminal and type $ python3 ~/chowderhead/whatever.py
1. Create a new file, call it "whatever.py"
2. Copy below code in it. Save it into your ~/chowderhead/
3. Start Axis, Un-stop & En it, home all.
4. Start terminal and type $ python3 ~/chowderhead/whatever.py
Code:
#!/usr/bin/env python
feed = 300
from subprocess import call
call(['axis-remote','-m', 'G38.3 Z-10 F{}'.format(feed)])
Please Log in to join the conversation.
2 years 7 months ago #295428
by Mecanix
Replied by Mecanix on topic Is there a way to touch-off purely in HAL?
Above method given being under the assumption you ain't fond of the unreliable c.mdi() that rarely wait. And I don't blame you. A way around that issue that I had luck with (sort of, still bugged) is with INTERP_IDLE. If you ever manage to write something up for rtai_api and achieve what you are trying to do (halrun/halcmd?), please share!
Code:
import linuxcnc
s = linuxcnc.stat()
c = linuxcnc.command()
def moveAxis(ax, pos, f):
try:
c.mode(linuxcnc.MODE_MDI)
c.wait_complete()
c.mdi('G1 {}{} F{}'.format(ax, pos, f))
s.poll()
while (s.interp_state != linuxcnc.INTERP_IDLE):
time.sleep(.01)
s.poll()
c.mode(linuxcnc.MODE_MANUAL)
except Exception as ex:
print('Error:', ex)
### call with
moveAxis(Z, -10, 300)
Please Log in to join the conversation.
2 years 6 months ago #299033
by bondglen
Replied by bondglen on topic Is there a way to touch-off purely in HAL?
I am also looking for a way to touch-off without using the keyboard.
I'm trying to build a remote pendant and want a button for touch-off.
I'm not using a USB/keyboard interface for my pendant, so I need to go thru HAL (I think).
I have looked at the previous reply, and don't really understand it. I am unfamiliar with python. I'm hoping to find a way to work with halcmd.
I'm trying to build a remote pendant and want a button for touch-off.
I'm not using a USB/keyboard interface for my pendant, so I need to go thru HAL (I think).
I have looked at the previous reply, and don't really understand it. I am unfamiliar with python. I'm hoping to find a way to work with halcmd.
Please Log in to join the conversation.
2 years 6 months ago #299048
by Aciera
Replied by Aciera on topic Is there a way to touch-off purely in HAL?
Why not use an MDI_COMMAND:
forum.linuxcnc.org/38-general-linuxcnc-q...parallel-port#292850
Note: you can use any mdi command, it does not have to be an m-code. ie you could also define:
[HALUI]
MDI_COMMAND = G38.3 Z-20 F100
and then connect it to your button in hal:
net run-probe <= your_pin_here => halui.mdi-command-00
forum.linuxcnc.org/38-general-linuxcnc-q...parallel-port#292850
Note: you can use any mdi command, it does not have to be an m-code. ie you could also define:
[HALUI]
MDI_COMMAND = G38.3 Z-20 F100
and then connect it to your button in hal:
net run-probe <= your_pin_here => halui.mdi-command-00
Please Log in to join the conversation.
2 years 6 months ago #299090
by bondglen
Replied by bondglen on topic Is there a way to touch-off purely in HAL?
Thanks, I think a MDI command may work well for me.
Please Log in to join the conversation.
- chowderhead
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 60
- Thank you received: 0
2 years 6 months ago #299328
by chowderhead
Replied by chowderhead on topic Is there a way to touch-off purely in HAL?
Sorry for the very late reply. Death in the family put all sideline projects on hold.
INTERP_IDLE has proven to be a mixed bag with other US components of mine. I'm looking at switching to C++ and getting a little lower level. If I have the chops.
INTERP_IDLE has proven to be a mixed bag with other US components of mine. I'm looking at switching to C++ and getting a little lower level. If I have the chops.
Please Log in to join the conversation.
- tommylight
-
- Offline
- Administrator
-
Less
More
- Posts: 22010
- Thank you received: 3
2 years 6 months ago #299334
by tommylight
Replied by tommylight on topic Is there a way to touch-off purely in HAL?
My condolences.
Please Log in to join the conversation.
Time to create page: 2.812 seconds
