Remap unused buttons to do manual tool release and rotate carousel (have ATC)

More
11 Feb 2024 04:15 #293057 by camb0
Hi,
I've got a wired probe that I keep outside of the milling enclosure due to the risk of coolant and chips getting into the cable hole.
I've got a 16 carousel tool changer, and have setup VERSA probe, the changes/touch-off's all work super, controlled via classic ladder.

Workflow:
-When getting setup to run a program
-I swap out the current tool for the probe tool, via air solenoid to release the tool, I do my probing and then remove the probe, .
-I also need to load/unload tools and I can only do that in one position on the carousel.

Ask:
Create 3 software buttons (instead of physical) to do: Tool Release (momentary), Carousel CW(momentary), Carousel CCW(momentary).
I don't use the following buttons (pretty sure I won't down the track either):
-Laser Off
-Ref Laser
-Tool Sensor
-Touch Plate
-Go to Sensor
-Ref Camera
And was wondering how hard it would be to: rename them, change to momentary get a hal signal for them and connect them with an "or" to move the carousel and release the tool. 
Ideally it would prevent them from being used if the spindle was running or it was in the middle of a program or a tool change.
I've been using sim_pin in a separate window to do this, but I'd like to drive it from the UI.

Thanks in advance,
Cam.



 

Please Log in or Create an account to join the conversation.

More
11 Feb 2024 05:38 #293061 by cmorley
What version of linuxcnc are you using?

Please Log in or Create an account to join the conversation.

More
11 Feb 2024 08:44 - 11 Feb 2024 22:43 #293067 by cmorley
I'm going to guess 2.9 and qtdragon_hd.
please rename and add this file to YOUR CONFIG FOLDER/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py
If something goes wrong you can erase/rename the file and everything will go back to the original.
You should get 3 momentary buttons and 3 HAL pin:
Component Pins:Owner   Type  Dir                 Value  Name  
702  bit   OUT                 FALSE  qtdragon.atc_ccw  
702  bit   OUT                 FALSE  qtdragon.atc_cw  
702  bit   OUT                 FALSE  qtdragon.atc_release

Hopefully that gets you what you need. 
Attachments:
Last edit: 11 Feb 2024 22:43 by cmorley. Reason: Typo is python file

Please Log in or Create an account to join the conversation.

More
16 Feb 2024 09:08 #293486 by camb0
Hi Chris,

Correct its 2.9.2 qtdragon_hd
Awesome thx for that will give it crack over the weekend and come back.

Cheers,
Cam.

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 04:36 #293575 by camb0
Confirming the version is:LINUXCNC - 2.9.2-112-g54bca16afd
I downloaded, added it to the directory, renamed it to "qtdragon_hd_handler.py.new", renamed the old one to "qtdragon_hd_handler.py.orig" and did a soft link "ln -s qtdragon_hd_handler.py.NEW qtdragon_hd_handler.py"

It came back with the error below, a couple of things
-the file I downloaded is 54 lines long (not a checksum but incase it was chopped off)
-I'll give it a go without the soft link and see what happens
Traceback (most recent call last):
File "/usr/bin/qtvcp", line 555, in <module>
_qtvcp = QTVCP()
File "/usr/bin/qtvcp", line 261, in __init__
window.load_extension(opts.usermod)
File "/usr/lib/python3/dist-packages/qtvcp/qt_makegui.py", line 269, in load_extension
methods, self[obj].handler_module, self[obj].handler_instance = self._load_handlers([handlerpath], self.halcomp, self[obj])
File "/usr/lib/python3/dist-packages/qtvcp/qt_makegui.py", line 297, in _load_handlers
mod = __import__(basename)
File "/usr/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py", line 20, in <module>
mod = importlib.import_module(module, PATH.SCREENDIR)
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py", line 22, in <module>
HandlerClass = mod.HandlerClass
AttributeError: module 'qtdragon_hd.qtdragon_hd_handler' has no attribute 'HandlerClass'

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 05:34 #293580 by cmorley
try without the soft link - just name the file qtdragon_hd_handler.py

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 05:57 - 17 Feb 2024 06:00 #293581 by camb0
I just had a play with the files and removing the soft links with no joy.
The only file in the directory containing the name "handler" is the new one you supplied.

So just to check I've done things right:
-downloaded the file from the browser (could use curl if that's an issue)
-moved the orig file out of that directory to a temporary spot (mv qtdragon_hd_handler.py ~/.)
-moved the downloaded file to that directory with the same name as the orig: qtdragon_hd_handler.py

Looking at the tail of the file I download doesn't look complete but I've not done any python - just started readying the doco.
cam@linuxcnc-mill:/usr/share/qtvcp/screens/qtdragon_hd$ tail qtdragon_hd_handler.py
            self.w['btn_{}'.format(i)].setObjectName(i)
            self.w['btn_{}'.format(i)].setProperty('isManSensitive',True)
            self.w['btn_{}'.format(i)].hal_init(HAL_NAME=i)
            self.w['btn_{}'.format(i)].setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
            self.w['btn_{}'.format(i)].setMinimumSize(66, 50)
            STATUS.connect('spindle-control-changed',  lambda w, num, state, speed, upto,obj= self.w['btn_{}'.format(i)]: obj.setEnabled(not state))
            self.w.horizontalLayout_40.addWidget(self.w['btn_{}'.format(i)] )
        self.w.btn_atc_release.setText('TOOL\nRELEASE')
        self.w.btn_atc_cw.setText('ATC\nCW')
        self.w.btn_atc_ccw.setText('ATC\nCCW')

[/code]
And this the directory content
[code][code]cam@linuxcnc-mill:/usr/share/qtvcp/screens/qtdragon_hd$ ls -al
total 824
drwxr-xr-x  3 root root   4096 Feb 17 16:49 .
drwxr-xr-x 17 root root   4096 Sep 21 17:52 ..
-rw-r--r--  1 root root  12232 Feb  3 09:35 argentium.qss
-rw-r--r--  1 root root   9694 Feb  3 09:35 brushed_metal_color.qss
-rw-r--r--  1 root root  10086 Feb  3 09:35 dark_grey.qss
-rw-r--r--  1 root root   9210 Feb  3 09:35 dark.qss
drwxr-xr-x  3 root root   4096 Feb 10 19:50 images
-rw-r--r--  1 root root   4304 Feb  3 09:35 metal.qss
-rw-r--r--  1 root root   3625 Feb  3 09:35 qtdragon_hd_ABOUT
-rw-r--r--  1 cam  cam    2109 Feb 16 20:54 qtdragon_hd_handler.py
-rw-r--r--  1 root root   1758 Feb  3 09:35 qtdragon_hd.qrc
-rw-r--r--  1 root root  10653 Feb  3 09:35 qtdragon_hd.qss
-rw-r--r--  1 root root 743323 Feb  3 09:35 qtdragon_hd.ui
-rw-r--r--  1 root root    398 Feb  3 09:35 version.txt
 
[/code][/code]
Last edit: 17 Feb 2024 06:00 by camb0. Reason: typo

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 07:14 #293583 by phillc54

please rename and add this file to YOUR CONFIG FOLDER/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py

I think the file should have been copied into this directory:
~/linuxcnc/configs/<CONFIG_DIR>/qtvcp/screens/qtdragon_hd/
The following user(s) said Thank You: camb0

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 08:52 #293593 by camb0
Boom that was it!!
Buttons are on the screen, will have a go at hooking them tomorrow.

Thx all

Please Log in or Create an account to join the conversation.

More
17 Feb 2024 17:24 #293637 by cmorley
Ahh Phill saw it right away!
Let us know how it goes.
The following user(s) said Thank You: camb0

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.098 seconds
Powered by Kunena Forum