radius/diameter programming and hal
- tcoleman978
- Offline
- Junior Member
Less
More
- Posts: 25
- Thank you received: 1
31 Dec 2023 01:37 #289406
by tcoleman978
radius/diameter programming and hal was created by tcoleman978
Is there a Secret Squirrel pin to determine the state of operation radius/diameter programming(G7/G8) in hal?
I want to tweek my Lathe MPG and need something to feed the mux select pin with.
I don't seem to know what to ask for cause the search comes up with literally nothing.
Oh and Happy New Years.
I want to tweek my Lathe MPG and need something to feed the mux select pin with.
I don't seem to know what to ask for cause the search comes up with literally nothing.
Oh and Happy New Years.
Please Log in or Create an account to join the conversation.
31 Dec 2023 13:21 #289430
by Aciera
Replied by Aciera on topic radius/diameter programming and hal
I don't think there is a hal pin that reflects the state of G7/G8 but you could run a custom component to create such pins. If you want to try this create a file 'linuxcnc-status.py' in your machine config and make it executable. Then add the line 'loadusr python linuxcnc-status.py' to your hal and start your config. Open the 'Show hal configuration' tool and you should find the pins under 'linuxcnc-status'
#!/usr/bin/env python
# to load this in in hal:
# loadusr python linuxcnc-status.py
import sys
import hal
import linuxcnc
# Make a component and pins
h = hal.component("linuxcnc_status")
h.newpin("g7-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("g8-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.ready()
# test connection to linuxcnc
try:
s = linuxcnc.stat() # create a connection to the status channel
s.poll() # get current values
except Exception as e:
print("error ", e)
sys.exit(1)
# loop
while 1:
# get current values
s.poll()
# Handle absolute / incremental (G90/G91) linuxcnc.stat.gcodes[6]
if s.gcodes[15] == 70:
h['g7-is-active'] = 1
h['g8-is-active'] = 0
elif s.gcodes[15] == 80:
h['g7-is-active'] = 0
h['g8-is-active'] = 1
else :
h['g7-is-active'] = 0
h['g8-is-active'] = 0
The following user(s) said Thank You: tommylight, tcoleman978
Please Log in or Create an account to join the conversation.
31 Dec 2023 14:20 #289432
by rodw
Replied by rodw on topic radius/diameter programming and hal
YOU can also find this value in the state_tags structure in real time
github.com/LinuxCNC/linuxcnc/blob/master...tion/state_tag.h#L46
YOu just have to get it out!
I think defining the relevant high level structure containing it could be done in a component
struct emcmot_command_t github.com/LinuxCNC/linuxcnc/blob/master...on.h#L206C13-L206C36
github.com/LinuxCNC/linuxcnc/blob/master...tion/state_tag.h#L46
YOu just have to get it out!
I think defining the relevant high level structure containing it could be done in a component
struct emcmot_command_t github.com/LinuxCNC/linuxcnc/blob/master...on.h#L206C13-L206C36
The following user(s) said Thank You: tcoleman978
Please Log in or Create an account to join the conversation.
- tcoleman978
- Offline
- Junior Member
Less
More
- Posts: 25
- Thank you received: 1
01 Jan 2024 02:43 #289456
by tcoleman978
Replied by tcoleman978 on topic radius/diameter programming and hal
BAM! worked like a charm, Thank you. Got me playing with the gmoccapy file itself and tweked the actual DRO display so that when in radius mode the diameter DRO is blank and while in diameter mode the diameter display reads X(radius blank) ........ like my Haas at work........
OOhhhh the rabbit holes.....
OOhhhh the rabbit holes.....
Please Log in or Create an account to join the conversation.
- tcoleman978
- Offline
- Junior Member
Less
More
- Posts: 25
- Thank you received: 1
01 Jan 2024 02:58 #289458
by tcoleman978
Replied by tcoleman978 on topic radius/diameter programming and hal
I understand what you are getting at. I use C+ with the Teensy's and ESP's.
But I think that is deeper than I can go right now.
Just starting to understand the layers as they stand. Heck just figured out that gmoccapy is mostly one big glade? and the whole thing is a cooperation of C+ and Python.........Linux has been my biggest hurdle just found doc's I didn't n
know were in there.
Thank you again and have a great New Year.
But I think that is deeper than I can go right now.
Just starting to understand the layers as they stand. Heck just figured out that gmoccapy is mostly one big glade? and the whole thing is a cooperation of C+ and Python.........Linux has been my biggest hurdle just found doc's I didn't n
know were in there.
Thank you again and have a great New Year.
Please Log in or Create an account to join the conversation.
07 Feb 2024 16:23 - 07 Feb 2024 16:31 #292752
by bobwolf
Replied by bobwolf on topic radius/diameter programming and hal
I don't think there is a hal pin that reflects the state of G7/G8 but you could run a custom component to create such pins. If you want to try this create a file 'linuxcnc-status.py' in your machine config and make it executable. Then add the line 'loadusr python linuxcnc-status.py' to your hal and start your config. Open the 'Show hal configuration' tool and you should find the pins under 'linuxcnc-status'
HI as in the request above I would like to create pins that indicate when I am in G54 or G55 if I copy your file I can see the pins in Show hal configuration with the changes to your file it doesn't even create the component... I don't even see the "original" pins my edited file ps how do I put the file inside the box, as I have seen in other posts? #!/usr/bin/env python # to load this in in hal: # loadusr python linuxcnc-status.py import sys import hal import linuxcnc # Make a component and pins h = hal.component("linuxcnc_status") h.newpin("g7-is-active", hal.HAL_BIT, hal.HAL_OUT) h.newpin("g8-is-active", hal.HAL_BIT, hal.HAL_OUT) h.newpin("g54-is-active", hal.HAL_BIT, hal.HAL_OUT) h.newpin("g55-is-active", hal.HAL_BIT, hal.HAL_OUT) h.ready() # test connection to linuxcnc try: s = linuxcnc.stat() # create a connection to the status channel s.poll() # get current values except Exception as e: print("error ", e) sys.exit(1) # loop while 1: # get current values s.poll() # Handle absolute / incremental (G90/G91) linuxcnc.stat.gcodes[6] if s.gcodes[15] == 70: h['g7-is-active'] = 1 h['g8-is-active'] = 0 elif s.gcodes[15] == 80: h['g7-is-active'] = 0 h['g8-is-active'] = 1 else : h['g7-is-active'] = 0 h['g8-is-active'] = 0 if s.gcodes[15] == 540: h['g54-is-active'] = 1 h['g55-is-active'] = 0 elif s.gcodes[15] == 550: h['g54-is-active'] = 0 h['g55-is-active'] = 1 else : h['g54-is-active'] = 0 h['g55-is-active'] = 0
Last edit: 07 Feb 2024 16:31 by bobwolf. Reason: ps how do I put the file inside the box, as I have seen in other posts?
Please Log in or Create an account to join the conversation.
07 Feb 2024 16:33 - 07 Feb 2024 16:34 #292755
by bobwolf
Replied by bobwolf on topic radius/diameter programming and hal
what a mess I made with the post :_(
Last edit: 07 Feb 2024 16:34 by bobwolf.
Please Log in or Create an account to join the conversation.
07 Feb 2024 16:43 #292757
by Aciera
Replied by Aciera on topic radius/diameter programming and hal
try this:
#!/usr/bin/env python
# to load this in in hal:
# loadusr python linuxcnc-status.py
import sys
import hal
import linuxcnc
# Make a component and pins
h = hal.component("linuxcnc_status")
h.newpin("g7-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("g8-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("g54-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.newpin("g55-is-active", hal.HAL_BIT, hal.HAL_OUT)
h.ready()
# test connection to linuxcnc
try:
s = linuxcnc.stat()
# create a connection to the status channel
s.poll()
# get current values
except Exception as e:
print("error ", e)
sys.exit(1)
#loop
while 1:
print(s.gcodes)
# get current values
s.poll()
# Handle absolute / incremental (G90/G91)
if s.gcodes[15] == 70:
h['g7-is-active'] = 1
h['g8-is-active'] = 0
elif s.gcodes[15] == 80:
h['g7-is-active'] = 0
h['g8-is-active'] = 1
else :
h['g7-is-active'] = 0
h['g8-is-active'] = 0
# Handle G54/G55
if s.gcodes[8] == 540:
h['g54-is-active'] = 1
h['g55-is-active'] = 0
elif s.gcodes[8] == 550:
h['g54-is-active'] = 0
h['g55-is-active'] = 1
else :
h['g54-is-active'] = 0
h['g55-is-active'] = 0
Please Log in or Create an account to join the conversation.
07 Feb 2024 16:57 #292759
by bobwolf
Replied by bobwolf on topic radius/diameter programming and hal
I tried and it doesn't work
does not create the component
you only changed from [15] to [8] in my edit; but what does it mean and where can I find the references?
does not create the component
you only changed from [15] to [8] in my edit; but what does it mean and where can I find the references?
Please Log in or Create an account to join the conversation.
07 Feb 2024 17:28 #292762
by Aciera
Replied by Aciera on topic radius/diameter programming and hal
Works for me though (on 2.9.1). Maybe try to start your config from the terminal and check for errors.
The line:
print(s.gcodes)
should give you an updating printout of the 'gcodes' list. The active work offset is in list item 8, while G7/G8 is in list item 15.
The line:
print(s.gcodes)
should give you an updating printout of the 'gcodes' list. The active work offset is in list item 8, while G7/G8 is in list item 15.
Please Log in or Create an account to join the conversation.
Time to create page: 0.095 seconds