Customized Gscreen for gear Hobbing machine

More
3 years 10 months ago #259902 by andypugh

They would normally have been copied into your ~/linuxcnc/configs folder. 
Did you look there? 
 

Please Log in to join the conversation.

More
3 years 10 months ago #259995 by Henk
HI Andy
It was the first place i looked.
The doc you posted helps, others too.

You have to copy the files from /usr/share/Gscreen....manually if you want to customise thhem.

Ill post progress....

Please Log in to join the conversation.

More
3 years 10 months ago #260009 by tommylight
Spammer booted.

Please Log in to join the conversation.

More
3 years 10 months ago #260140 by Henk
HI
Ok, so i have looked at Gscreen and installed Glade. 

I think the Industrial version is a good starting point. One thing i could not figure out immediately was how to adapt Gscreen to suit my screen resolution. The widgets are a bit out of place and it doesnt use the entire screen area effectively. 

Do i have to play around in Glade to fix this or is there a better way?

I know about this document, are there any other information available?  linuxcnc.org/docs/stable/html/gui/gscreen.html
 

Please Log in to join the conversation.

More
3 years 10 months ago #260141 by cmorley
gscreen is built on top of gladevcp. Gladevcp uses pygtk.

So gladevcp docs in linuxcnc might help a bit and pygtk tutorials can be helpful too.

Please Log in to join the conversation.

More
3 years 10 months ago #260298 by Henk
HI
I started playing with the industrial_handler.py and industrial glade files.
What i would like to achieve is to change the "setup" tab (man mode) to include the gear hobbing setup parameters similar to Andy's hobbing screen. 

As a first step, i tried to remove the gremlin preview from the setup (man mode) tab, but keep it in the auto tab and MDI tab. 

The show_box that contains gremlin is in notebook_main, page 0, so it stays with the main screen. I would like to move it to notebook_mode, but not sure how to achieve this. I can cut/paste it in glade, and i think it is ok, but i dont understand how the following code works to specify what is displayed when the different tabs are selected.

Would you mind explaining how "self.data.mode_order" functions, bearing in mind my limited, but developing python knowledge
Code:
    # display the main tab and set the mode to setup     def on_setup_button_clicked(self,widget):         self.widgets.notebook_main.set_current_page(0)         self.data.mode_order = _MAN,_MDI,_AUTO         label = self.data.mode_labels         self.widgets.button_mode.set_label(label[self.data.mode_order[0]])         self.gscreen.mode_changed(self.data.mode_order[0])         self.toggle_modes(widget)     # display the main tab and set the mode to run     def on_run_button_clicked(self,widget):         self.widgets.notebook_main.set_current_page(0)         self.data.mode_order = _AUTO,_MAN,_MDI         label = self.data.mode_labels         self.widgets.button_mode.set_label(label[self.data.mode_order[0]])         self.gscreen.mode_changed(self.data.mode_order[0])         self.toggle_modes(widget)     # display the main tab and set the mode to MDI     def on_mdi_button_clicked(self,widget):         self.widgets.notebook_main.set_current_page(0)         self.data.mode_order = _MDI,_MAN,_AUTO         label = self.data.mode_labels         self.widgets.button_mode.set_label(label[self.data.mode_order[0]])         self.gscreen.mode_changed(self.data.mode_order[0])         self.toggle_modes(widget)


 

Please Log in to join the conversation.

More
3 years 10 months ago #260300 by cmorley
It's been awhile since being in the code...

mode_order is the variable that holds the order of machine modes: Manual, MDI, and Auto.
Originally thought to be toggled through.

But this is the code you probably want to see - it's in gscreen.py

Code:
    # adjust the screen as per each mode toggled     def mode_changed(self,mode):         if mode == self.data._MAN:             self.widgets.vmode0.show()             self.widgets.vmode1.hide()             self.widgets.notebook_mode.hide()             self.widgets.hal_mdihistory.hide()             self.widgets.button_homing.show()             self.widgets.dro_frame.show()             self.widgets.spare.hide()         elif mode == self.data._MDI:             if self.widgets.button_homing.get_active():                 self.widgets.button_homing.emit("clicked")             if self.data.plot_hidden:                 self.toggle_offset_view()             self.emc.set_mdi_mode()             self.widgets.hal_mdihistory.show()             self.widgets.vmode0.show()             self.widgets.vmode1.hide()             self.widgets.notebook_mode.hide()         elif mode == self.data._AUTO:             self.widgets.vmode0.hide()             self.widgets.vmode1.show()             if self.data.full_graphics:                 self.widgets.notebook_mode.hide()             else:                 self.widgets.notebook_mode.show()             self.widgets.hal_mdihistory.hide()         if not mode == self.data._MAN:             self.widgets.button_jog_mode.set_active(False)             self.widgets.button_homing.set_active(False)             self.widgets.button_homing.hide()             self.widgets.spare.show()         for i in range(0,3):             if i == mode:                 self.widgets["mode%d"% i].show()             else:                 self.widgets["mode%d"% i].hide()



If you open a terminal and type:
gscreen -F | more
You can see some more information on gscreen's functions - or just look at the source code.

Please Log in to join the conversation.

More
3 years 10 months ago #260608 by Henk
Update and another question.

I tried to understand the python files, although i can read the code and sort of understand how it functions, im finding it hard to add additional functionality. Because of that, i found a workaround that works for me, and that is to use the hal widgets to create a UI page where i can interact directly with hal. I have to write a realtime comp for the hobbing axes syncronisation anyway so i can use that to do some of the checks and calculations and display the results on Gscreen after linking throug hal again......Ugly, i know but it works for me. 

Now another question. 
Gscreen (industrial) is designed for a touch screen interface. There are a couple of things i want to link to hardware buttons.

Axis selection, for example. I have a rotary switch that selects x,y,z,a and c axes for my mpg and jog buttons (+ and -). I want this selection to select the axis on the gui without having to click that axis on the setup page. So i need to add hal pins for selecting the axis according to the switch position. 

Is this something that should go in the handler py file or would it require changes in gscreen.py?
 

Please Log in to join the conversation.

More
3 years 10 months ago #260689 by cmorley
extra pins go in the handler.
Something like this should work:
Code:
import hal_glib     def __init__(self, halcomp,builder,useropts,gscreen):             self.emc = gscreen.emc             self.data = gscreen.data             self.widgets = gscreen.widgets             self.gscreen = gscreen             self.halcomp = halcomp # <-----     def initialize_pins(self):         self.gscreen.initialize_pins()         for axis in self.data.axis_list:             self.data['jog-select-%s'% axis] = hal_glib.GPin(self.halcomp.newpin('jog-select-%s'% axis, hal.HAL_S32, hal.HAL_IN))             self.data['jog-select-%s'% axis].connect('value-changed', self.on_hal_jog_select_changed)     def on_hal_jog_select_changed(self,gpin):         print(gpin.get_name())         for axis in self.data.axis_list:             pin = 'jog-select-%s'% axis             # does the changed pin match list ?             if gpin.get_name() == pin:                 # and the pin true                 if gpin.get():                     self.widgets['axis_%s'%axis].set_active(1)                     self.gscreen.update_active_axis_buttons(self.widgets['axis_%s'%axis])                 # else clear HAL pin and widget                 else:                     self.widgets['axis_%s'%axis].set_active(0)                     self.data['jog-select-%s'% axis].set(0)             else:                 self.widgets['axis_%s'%axis].set_active(0)

Please Log in to join the conversation.

More
3 years 9 months ago #260755 by Henk
HI Chris. Thank you for this. It works, apart from one issue. When the axis selection goes up in the list, i.e from x - y - z ... it works as expected and the buttons are active according to the hal signals. But when going down on the selection list, for example from z back to y, all the buttons on the gui are inactive. so it seems that the button state is only updated when selecting the next axis higher up in the list, not when going down. Reading the code, it is not clear (to me) why it behaves like this.

I have encountered two other issues with homeing.
My machine axis/joint configuration is xyzac => joint 0 to joint 4. When i want to home a single axis from the gui, X,Y,Z and A homes as expected, but no response from the C axis. I found that Gscreen wants to home joint 5 when i try to home the c axis, of course joint 5 does not exist. 

I think this is an issue in gscreen.py because in the list "xyzabcuvw", c would be joint 5. I guess this because it was written way before the joint/axis split. 

Joint 4 (c) in my config is set up to home immediately.  When i click the home-all button, it homes as expected, but because the x and y axis on this machine works from the same drive, they cannot operate together and have to be selected. I can probably automate this in HAL so that home all works, but i would like to be able to home selected axes as well.

edit: the other issue is that the " * " indicator for axis homed only show next to the last homed axis. It doesnt show when the next axis homes

How can we fix this? 
Can i define the c axis as joint 5 in my ini file, without a joint 4? have not tried this
 

Please Log in to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum