Tuesday, 25 December 2012

EMC Setup. Glade Vs pyvcp

Hands up all those who survived the end of the world :p

I have spent the last few days poking around EMC2 linuxcnc. For an Open source project this is Awesome, it has good documentation and good delivery of its end goal, control a machine and make it do our bidding.

I have been playing around making an UI that has all the functions i want, where i want them and working how i want them to work. So i read a bit of documentation and thought i had picked the path of least resistance, not really knowing what Glade was and having a little experience with python i went with the pyvcp option. this is great it allows you to do all sorts of things, control various parts of the machine, in my case a milling machine and dividing head. i went through the steps of setting up the parallel ports and defining pins to each hardware device i want to use.

Next i wanted to find some GUI interface that would allow me to control these hardware functions easily from a touchscreen. when i first created the custom vcp it was tacked onto the right hand edge of the existing UI window, this in theory is great makes life easy, in practice this is not so great for my setup, i am using a 800x600 LCD screen and i have a PCT touchscreen to match it, when the extra section of controls were added to the window it makes EMC's GUI go nuts. every time you click the mouse or touch the screen the page would jump between locating the top left corner of the window to the top left corner of the screen then next touch it would jump to show the bottom right of the window in the bottom right of the screen. this is not noticed if the window is smaller than your screen but if it is larger then you will see this problem. two solutions exist that i know of, use a higher screen res (not an option for me as i am hardware limited to 800x600), add the control panel as a second floating window and provide a way to switch between this and the original UI window.

i chose the second option, this works nice , the original UI is a little narrower than the screen so i anchored the new window to the top right of the screen and kept the original screen in the top left. this keeps a 1 inch section of screen that i can use to touch to swap between windows. i then populated the window with lots of big buttons and sliders that are nice to use in a touchscreen environment. i hear people screaming why not just use touchy.pyvcp interface that is supplied? please see the problem just above with the screen jumping around when the window is larger than 800x600. probably not the most efficient solution but it gets me to where i need to be. plus i have a few other features i wanted to add to the mix. and as it turns out its easy as pi to roll your own.

I added sliders for a grinding motor, coolant pump, work lamp brightness, spindle speed and jog speed. with these i added enable buttons, which i made latch with the classicladder PLC thats built into EMC, this was easy to do as i have learnt PLC programming a decade ago, even though i have never used it since it was easy to work out again all those classes in the basement of granville tafe came flooding back, my project was a railway level crossing, train sensors lights, bells, it was a great project.  the PLC is a very powerful tool it took me a little playing and looking at the examples to work out how the variables integrate with the UI and the HAL but i think i have three quarters of a clue now. I added jog buttons these buttons all work. I even programmed a home axis button with MDI commands :)

I was going great guns for a while. I stopped for some family time (ie Christmas) then came back to it. The last thing that i really wanted to setup was at the very least was a simple tool changer routine. My plan is to use a stepper connected to the 5th axis to rotate a carousel of tools at a set X,Y,Z location so the chuck could release and hold tools as they are presented to it. this is when i have hit a SOLID Brick wall. I should have read a bit more of the manual and the hardware integrators guide to see exactly what pyvcp can and cannot do (maybe i read it but didn't understand at the time that i need more features). i could write a massive PLC  ladder program to try and control the tool changer from that but it would be really hard and probably wont end up being doable.

I have come to the conclusion that i MUST use glade to get the control and program-ability i am going to require. this was a great learning experience and my efforts have not been wasted, i will use this setup until i make my tool changer.. then once i have the mechanical parts done come back to the UI.

while i am waiting to get my last toothed belt from my mates locked up workshop i have been thinking about what i can do to use my time and actually use the mill, while making the UI was great i want to get some chips flying. so i am going to try and make some progress on the mill in the fashion of the magnetic clamping bed. more next post.

1 comment:

  1. If your tool changer can be run via G-Code, then a process can be done with the pyVCP panel. I have added buttons which call a subroutine... and after an upgrade to AXIS 2.5.x (now on 2.6.7) they added the ability to pass data from the panel to the G-Code.

    For example, I have some spinboxes to set parameters for a Peck-Drill cycle... the user can position the tool where they want the hole, then use the panel to select depth, peck depth, and feed rate... then click the button to activate. Writing G-Code (for them) is not required now.


    I'm actually looking into the possibility of having BOTH a pyVCP panel on the right, and a GLADE panel as a tabbed space in the center of the AXIS screen. Should be interesting.