adding an automatic tool number after homing

More
25 Oct 2022 17:40 #255051 by Wusel
geeo evening everyone.
currently I  rework a LuxTrun LTSi and it will be equipped with LinuxCNC.
It is equipped with an 8 station tool changer of a fairly common type. It rotates only in one direction an locks against steel plate into the other direction.  I had rebuild the same machine before once with Mach3 and once with Eding CNC. In both cases I wrote a Macro which was executed whe I issued the M6 command. I started reading how to do it in LinuxCNC and encoutered different possibilities. One is to Remap the M6 command, the other one just to alter M6 or write a Python script . Would the Remap way be the most suitable way? Before I get involved into this I want to start with something simple and just set the tool to 1 after homing my tool changer which is set up as A-axis. Manually i would do this with the M61 command, i believe but where do I insert this  to have it done automatically?
thanks for your help

Rainer

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

More
25 Oct 2022 21:56 #255061 by andypugh
Does the toolchanger have any sort of position feedback?

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

More
26 Oct 2022 18:46 #255121 by Wusel
the toolchanger is driven with a simple stepper motor without any feedback. I guess with a feedback loop it would throw up an error each time it locks up. If i did it manually with g-code I would do in relative Modde G0 Axx to advance xx degrees to the correct tool, then G1 A-5 to reverse a little bit and lock it up and then set the new tool with M61 Qnn. this is basically the macro I wrote for the Eding control
regards

Rainer

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

More
27 Oct 2022 12:56 #255188 by andypugh
I was really asking if there were any position sensors for each tool station, so that the system knows which tool is in position. Is there a tool-1 index at least?

From what you have said it would be simplest to re-map the T command to a G-code subroutine. (That way you also get to embed the M6 in the remap and automatically run G43 to apply the tool table offsets)

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

More
27 Oct 2022 17:25 #255206 by Wusel
I have an Index for tool one, it is basically the home switch which is positioned just after passing the tool 1 position. From there I reverse slightly during homing and have the position locked for tool 1
When I read about the different possibilities I also had the feeling that the Remap ist the most suitable way for me but havent't advanced so far yet that I get anything moving with the remap

regards

Rainer

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

More
27 Oct 2022 23:34 #255259 by andypugh
Take it step-by-step.

Add the REMAP command to the INI, just calling an NGC file.
[RS264NGC]
REMAP=T ngc=toolchange

Then create a G-code file in the config directory (not in nc-files, in the same directory as the INI file) called toolchange.ngc
O <toolchange> sub

(debug, T-remap: loaded tool=#<_current_tool> current pocket: #<_current_pocket>)
(debug, T-remap: selected tool=#<_selected_tool> selected pocket: #<_selected_pocket>)

M6 T#<_selected_tool>
O <toolchange> endsub [1]
M2

Note that this won't actually work, but it's a start on the process.
The problem is that it is T that populates #<_selected_pocket> and #<_selected too> and if you remap them you don't get it.
I am trying to work out how to access the number passed to the T command.

You might need to additionally add ":." to the SUBROUTINE_PATH in the INI file if the system errors out with "File not open" SUBROUTINE_PATH is a list of colon-delimited paths, so adding :. at the end add the local direcory "." to the end.
The following user(s) said Thank You: mgm

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

More
28 Oct 2022 10:51 #255293 by hitchhiker
with the help of andy i come to the same point...

when homing the toolchanger and the changer is homed..set tool1 as active tool...

it would be great to get it work...

thanks andy for your great help...

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

More
28 Oct 2022 10:54 #255294 by Wusel
is the parameter _current_tool and _selected_tool defined somewhere or are they generic? I only find in the hal viewer something like tool-number for the new tool?

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

More
28 Oct 2022 12:48 #255297 by Wusel
continued to read about parameters and found that #<_current_tool> and #<_selected_tool> are global parameters

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

More
28 Oct 2022 14:56 #255299 by andypugh
To set the tool number to 1 (probably using M61) you would want to trigger on joint.2.is-homed (ie, once the A axis homing is complete)

One possible way to do this is with an MDI_COMMAND:
linuxcnc.org/docs/stable/html/config/ini....html#_halui_section

In the INI
[HALUI]
MDI_COMMAND = M61 Q1 G43

In a HAL file:
net changer-homed joint.2.is-homed => halui.mdi-command-00
The following user(s) said Thank You: tommylight

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

Time to create page: 0.090 seconds
Powered by Kunena Forum