Is there a way to touch-off purely in HAL?
- chowderhead
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 11
07 Mar 2024 18:32 #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 or Create an account to join the conversation.
- Mecanix
- Offline
- Platinum Member
Less
More
- Posts: 446
- Thank you received: 220
07 Mar 2024 20:12 - 07 Mar 2024 20:15 #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
#!/usr/bin/env python
feed = 300
from subprocess import call
call(['axis-remote','-m', 'G38.3 Z-10 F{}'.format(feed)])
Last edit: 07 Mar 2024 20:15 by Mecanix.
Please Log in or Create an account to join the conversation.
- Mecanix
- Offline
- Platinum Member
Less
More
- Posts: 446
- Thank you received: 220
07 Mar 2024 20:28 #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!
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)
The following user(s) said Thank You: chowderhead
Please Log in or Create an account to join the conversation.
- bondglen
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 1
24 Apr 2024 22:13 #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 or Create an account to join the conversation.
- Aciera
- Offline
- Administrator
Less
More
- Posts: 4017
- Thank you received: 1732
25 Apr 2024 07:33 - 25 Apr 2024 07:49 #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
Last edit: 25 Apr 2024 07:49 by Aciera.
Please Log in or Create an account to join the conversation.
- bondglen
- Offline
- New Member
Less
More
- Posts: 14
- Thank you received: 1
26 Apr 2024 01:17 #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 or Create an account to join the conversation.
- chowderhead
- Offline
- Senior Member
Less
More
- Posts: 57
- Thank you received: 11
29 Apr 2024 17:00 #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 or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19479
- Thank you received: 6532
29 Apr 2024 18:52 #299334
by tommylight
Replied by tommylight on topic Is there a way to touch-off purely in HAL?
My condolences.
Please Log in or Create an account to join the conversation.
Time to create page: 0.062 seconds