various linking signal problems
02 Jul 2019 18:02 #138425
by dangu85
various linking signal problems was created by dangu85
So, I actually started to write a gui to implement in axis, and obviously I got a few things which don't work...
1. The max velocity slider isn't working at all. I linked the halui.max-velocity.scale signal in postgui.hal but it does not change.
2. I'd like to change the text of the Status Label with something that reflects the status of the machine(Emergency on, Ready, Running, Paused or so), and don't know what to do.
3. The Spindle Toggle Button works only to turn on the spindle and not to turn it off. I've linked the spindle-run halui.spindle.start to the button, but don't know how to link the spindle-run halui.spindle.stop to its off-state. For the other 2 outputs I've cheated using the toggle function and a normal button, but i'd like to adjust them to use a proper toggle button.
4. Damned combo box! How can I pass that unsigned int to an oword subroutine???? I've tryed to call the function with that Set button, but I don't know if I'm passing the parameter correctly or is something wrong in the subroutine.. Much confusion here
5. To do.. I'm planning to remap M6 when I'm done with this, but by then I should have lerned a bit more
6. Is it possible to do points from 1 to 4 avoiding python???
Thanks
config here
1. The max velocity slider isn't working at all. I linked the halui.max-velocity.scale signal in postgui.hal but it does not change.
2. I'd like to change the text of the Status Label with something that reflects the status of the machine(Emergency on, Ready, Running, Paused or so), and don't know what to do.
3. The Spindle Toggle Button works only to turn on the spindle and not to turn it off. I've linked the spindle-run halui.spindle.start to the button, but don't know how to link the spindle-run halui.spindle.stop to its off-state. For the other 2 outputs I've cheated using the toggle function and a normal button, but i'd like to adjust them to use a proper toggle button.
4. Damned combo box! How can I pass that unsigned int to an oword subroutine???? I've tryed to call the function with that Set button, but I don't know if I'm passing the parameter correctly or is something wrong in the subroutine.. Much confusion here
5. To do.. I'm planning to remap M6 when I'm done with this, but by then I should have lerned a bit more
6. Is it possible to do points from 1 to 4 avoiding python???
Thanks
config here
Attachments:
Please Log in or Create an account to join the conversation.
02 Jul 2019 20:19 #138431
by cmorley
Replied by cmorley on topic various linking signal problems
1 halui.max-velocity needs the scale and direct-value switch set properly
2 requires a python handler file and python code
3 would require either python code or HAL plumbing to convert the single Gladevcp HAL pin to two HAL pins (probably the toggle component)
4 I haven't worked with gladevcp's combo box or oword subroutines much - I know you must add a list store and set that up - this might help:
Chris
2 requires a python handler file and python code
3 would require either python code or HAL plumbing to convert the single Gladevcp HAL pin to two HAL pins (probably the toggle component)
4 I haven't worked with gladevcp's combo box or oword subroutines much - I know you must add a list store and set that up - this might help:
Chris
Please Log in or Create an account to join the conversation.
07 Jul 2019 13:06 #138798
by dangu85
Replied by dangu85 on topic various linking signal problems
Is there any example to solve 2 and 3?? I can't find anything that doesn't add more confusion on how to solve it...
But at last I managed to implement an M6 remap
But at last I managed to implement an M6 remap
Please Log in or Create an account to join the conversation.
07 Jul 2019 18:06 #138812
by cmorley
Replied by cmorley on topic various linking signal problems
What version of linuxcnc are you using?
Chris M
Chris M
Please Log in or Create an account to join the conversation.
07 Jul 2019 18:36 #138817
by dangu85
Replied by dangu85 on topic various linking signal problems
current release 2.7.14
Please Log in or Create an account to join the conversation.
07 Jul 2019 21:40 - 07 Jul 2019 21:56 #138823
by cmorley
Replied by cmorley on topic various linking signal problems
Here is sample code to do something like what u want.
2.7 is a bit limited with GSTAT but still quite useful.
This handler file assumes that there are three labels called:
state_label
e_state_label
interp_state_label
and a regular push button with a 'pressed' signal that calls 'on_button1_pressed' (set up in GLADE file)
It will create two HAL pins spindle-on-trigger and spindle-off-trigger to be connected to HALUI
You would have to adjust the gladevcp command to load the handler file too.
Chris M
2.7 is a bit limited with GSTAT but still quite useful.
This handler file assumes that there are three labels called:
state_label
e_state_label
interp_state_label
and a regular push button with a 'pressed' signal that calls 'on_button1_pressed' (set up in GLADE file)
It will create two HAL pins spindle-on-trigger and spindle-off-trigger to be connected to HALUI
You would have to adjust the gladevcp command to load the handler file too.
import hal
import glib
import time
from hal_glib import GStat, GPin
GSTAT = GStat()
class HandlerClass:
def __init__(self, halcomp,builder,useropts):
self.halcomp = halcomp
self.builder = builder
GSTAT.connect("state-estop",lambda w: self.update_estate_label('ESTOP'))
GSTAT.connect("state-estop-reset",lambda w: self.update_estate_label('RESET'))
GSTAT.connect("state-on",lambda w: self.update_state_label('MACHIBE ON'))
GSTAT.connect("state-off",lambda w: self.update_state_label('MACHINE OFF'))
GSTAT.connect("interp-paused",lambda w: self.update_interp_label('Paused'))
GSTAT.connect("interp-run",lambda w: self.update_interp_label('Run'))
GSTAT.connect("interp-idle",lambda w: self.update_interp_label('Idle'))
self.on_trigger = GPin(halcomp.newpin('spindle-on-trigger', hal.HAL_BIT, hal.HAL_OUT))
self.off_trigger = GPin(halcomp.newpin('spindle-off-trigger', hal.HAL_BIT, hal.HAL_OUT))
def update_state_label(self,text):
self.builder.get_object('state_label').set_label("State: %s" % (text))
def update_estate_label(self,text):
self.builder.get_object('e_state_label').set_label("E State: %s" % (text))
def update_interp_label(self,text):
self.builder.get_object('interp_state_label').set_label("Interpeter State: %s" % (text))
def on_button1_pressed(self, obj):
state = True
# is spindle already enabled?
if GSTAT.stat.spindle_enabled:
state = False
# toggle HAL pins to command HALUI
self.on_trigger.set(state)
self.off_trigger.set(not state)
def get_handlers(halcomp,builder,useropts):
return [HandlerClass(halcomp,builder,useropts)]
Chris M
Last edit: 07 Jul 2019 21:56 by cmorley. Reason: typo
Please Log in or Create an account to join the conversation.
08 Jul 2019 16:51 #138876
by dangu85
Replied by dangu85 on topic various linking signal problems
ok. I'm starting to get it little by little.
Labels are working. Is there a list of that GSTATs available to monitor? Are these returning always a boolean value to use?
The button is working too, but I've noticed it's a bit glitchy. If the spindle is set to run from axis, if I try to stop it with the glade button it wont. The same if i start it with the glade one and than stop it from axis, when i try to start it again from glade button it wont. I think it keeps the old state because from axis it does not refresh the pin..
Time for experiments. Let u know the news
Thanks for help
Labels are working. Is there a list of that GSTATs available to monitor? Are these returning always a boolean value to use?
The button is working too, but I've noticed it's a bit glitchy. If the spindle is set to run from axis, if I try to stop it with the glade button it wont. The same if i start it with the glade one and than stop it from axis, when i try to start it again from glade button it wont. I think it keeps the old state because from axis it does not refresh the pin..
Time for experiments. Let u know the news
Thanks for help
Please Log in or Create an account to join the conversation.
08 Jul 2019 18:41 #138886
by dangu85
Replied by dangu85 on topic various linking signal problems
Oh! For the combobox I've done the same table as the exemple with 2 colums. One with the description associated with a float parameter.
I think the problem is sending the variable to the called oword with the Set button.
I don't feel I'm doing the right way...Actually the mdi command is like so:
O<testtenda> call [${gfloat1-f}]
the oword subroutine is this
O <testtenda> sub
o101 if [#1 EQ 54]
G54
o101 elseif [#1 EQ 55]
G55
o101 elseif [#1 EQ 56]
G56
o101 elseif [#1 EQ 57]
G57
o101 elseif [#1 EQ 58]
G58
o101 elseif [#1 EQ 59]
G59
o101 elseif [#1 EQ 60]
G59.1
o101 elseif [#1 EQ 61]
G59.2
o101 elseif [#1 EQ 62]
G59.3
o101 endif
O <testtenda> endsub
M2
I think the problem is sending the variable to the called oword with the Set button.
I don't feel I'm doing the right way...Actually the mdi command is like so:
O<testtenda> call [${gfloat1-f}]
the oword subroutine is this
O <testtenda> sub
o101 if [#1 EQ 54]
G54
o101 elseif [#1 EQ 55]
G55
o101 elseif [#1 EQ 56]
G56
o101 elseif [#1 EQ 57]
G57
o101 elseif [#1 EQ 58]
G58
o101 elseif [#1 EQ 59]
G59
o101 elseif [#1 EQ 60]
G59.1
o101 elseif [#1 EQ 61]
G59.2
o101 elseif [#1 EQ 62]
G59.3
o101 endif
O <testtenda> endsub
M2
Please Log in or Create an account to join the conversation.
09 Jul 2019 01:00 - 09 Jul 2019 01:00 #138920
by cmorley
from source, you can glean the return type from the gobject.TYPE:
The 2.8/master version has way more and docs too.
glichy button is because the HAL pin is only toggled the next time the GUI buttons are pressed. If something else toggles linuxcnc state the pins are not reset properly. You could probably fix that with timers between setting the pin true to set it false after a half second, but at that point you may as well add some more python and control the spindle in python.
adding:
import linuxcnc
CMD = linuxcnc.command()
CMD.spindle(linuxcnc.SPINDLE_FORWARD)
CMD.spindle(linuxcnc.SPINDLE_REVERSE)
CMD.spindle(linuxcnc.SPINDLE_OFF)
Chris M
Replied by cmorley on topic various linking signal problems
ok. I'm starting to get it little by little.
Labels are working. Is there a list of that GSTATs available to monitor? Are these returning always a boolean value to use?
The button is working too, but I've noticed it's a bit glitchy. If the spindle is set to run from axis, if I try to stop it with the glade button it wont. The same if i start it with the glade one and than stop it from axis, when i try to start it again from glade button it wont. I think it keeps the old state because from axis it does not refresh the pin..
Time for experiments. Let u know the news
Thanks for help
from source, you can glean the return type from the gobject.TYPE:
'state-estop': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'state-estop-reset': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'state-on': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'state-off': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'homed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)),
'all-homed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'not-all-homed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)),
'mode-manual': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'mode-auto': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'mode-mdi': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'interp-run': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'interp-idle': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'interp-paused': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'interp-reading': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'interp-waiting': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'file-loaded': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_STRING,)),
'reload-display': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ()),
'line-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_INT,)),
'tool-in-spindle-changed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, (gobject.TYPE_INT,)),
The 2.8/master version has way more and docs too.
glichy button is because the HAL pin is only toggled the next time the GUI buttons are pressed. If something else toggles linuxcnc state the pins are not reset properly. You could probably fix that with timers between setting the pin true to set it false after a half second, but at that point you may as well add some more python and control the spindle in python.
adding:
import linuxcnc
CMD = linuxcnc.command()
CMD.spindle(linuxcnc.SPINDLE_FORWARD)
CMD.spindle(linuxcnc.SPINDLE_REVERSE)
CMD.spindle(linuxcnc.SPINDLE_OFF)
Chris M
Last edit: 09 Jul 2019 01:00 by cmorley.
Please Log in or Create an account to join the conversation.
09 Jul 2019 17:51 #138962
by dangu85
Replied by dangu85 on topic various linking signal problems
oh yes! It works for the spindle. I've dove the same for mist and flood controls but it sets them only ON.
def flood_pressed(self, obj):
state = True
CMD.flood(linuxcnc.FLOOD_ON)
# is flood already enabled?
if GSTAT.stat.flood_enabled:
state = False
CMD.flood(linuxcnc.FLOOD_OFF)
# toggle HAL pins to command HALUI
self.on_trigger3.set(state)
self.off_trigger3.set(not state)
I think it's not correct to check for flood_enabled ...mmmm...
def flood_pressed(self, obj):
state = True
CMD.flood(linuxcnc.FLOOD_ON)
# is flood already enabled?
if GSTAT.stat.flood_enabled:
state = False
CMD.flood(linuxcnc.FLOOD_OFF)
# toggle HAL pins to command HALUI
self.on_trigger3.set(state)
self.off_trigger3.set(not state)
I think it's not correct to check for flood_enabled ...mmmm...
Please Log in or Create an account to join the conversation.
Moderators: HansU
Time to create page: 0.104 seconds