Got some troubles with my tool change routines
31 May 2019 13:20 #135466
by anfänger
Got some troubles with my tool change routines was created by anfänger
Hi Guys,
I'm in the final steps of retrofitting my Chiron CNC with a basket tool changer.
I the baby running except the emergency stop (wich kicks in before the spindle brake. But this shouldn't be a to big issue cause I have already some ideas how to tackle this) and the tool change. To run this this safely I have to move the Spindle up. And I also want to be able to use tools other than the one in the tool changer. For the old Sinumerik I implemented this in the post processor of my CAM and I could also do it for linuxcnc. But I would prefer It to be "hard coded" into the machine.
So I started to write a script an remapped it to m6. But This is not working well, cause the I can't properly read the hal pins in ngc. They are updated to slow, so the variable #<_hal[iocontrol.0.tool-prep-number]> is not reliable.
The actual Mcodes work well cause they are in bash and there I can read the hal pins correctly. But the logic where to move an what Mcodes to trigger is in ngc. So is there another way to read hal pins in ngc? or a way to move the machine from bash (I use 2.7 linuxcnc)?
Here are the codes I use:
Thaks Patrick
I'm in the final steps of retrofitting my Chiron CNC with a basket tool changer.
I the baby running except the emergency stop (wich kicks in before the spindle brake. But this shouldn't be a to big issue cause I have already some ideas how to tackle this) and the tool change. To run this this safely I have to move the Spindle up. And I also want to be able to use tools other than the one in the tool changer. For the old Sinumerik I implemented this in the post processor of my CAM and I could also do it for linuxcnc. But I would prefer It to be "hard coded" into the machine.
So I started to write a script an remapped it to m6. But This is not working well, cause the I can't properly read the hal pins in ngc. They are updated to slow, so the variable #<_hal[iocontrol.0.tool-prep-number]> is not reliable.
The actual Mcodes work well cause they are in bash and there I can read the hal pins correctly. But the logic where to move an what Mcodes to trigger is in ngc. So is there another way to read hal pins in ngc? or a way to move the machine from bash (I use 2.7 linuxcnc)?
Here are the codes I use:
o<sub_progs/toolchange> sub
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
G4 P1
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
G4 P1
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
G4 P1
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
G4 P1
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]> (Debugging)
o500 if [#<_hal[iocontrol.0.tool-number]> NE #<_hal[iocontrol.0.tool-prep-number]>]
o501 if [#<_hal[iocontrol.0.tool-number]> EQ 0]
M110 (unlock tool)
M112 (lower basket)
(load new tool)
o<sub_progs/loadtool> call
o501 elseif [#<_hal[iocontrol.0.tool-number]> GT 0]
(remove tool)
o<sub_progs/removetool> call
o501 endif
M108 P1 Q1
o502 if [#<_hal[iocontrol.0.tool-prep-number]> EQ 0]
M113 (raise basket)
M111(lock tool)
M6 G43
o502 elseif [#<_hal[iocontrol.0.tool-prep-number]> GT 0]
(load next tool)
o<sub_progs/loadtool> call
o502 endif
o500 endif
o<sub_progs/toolchange> endsub
o<sub_progs/removetool> sub
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
o502 if[ #<_hal[iocontrol.0.tool-number]> LE 12] (tool in basket)
M108 P20 Q1
G0 G53 Z0
M110 (unlock tool)
M112 (lower basket)
M116 (raise tool arms)
o502 elseif [#<_hal[iocontrol.0.tool-number]> GT 12] (tool not in basket )
M108 P20 Q3
G53 G0 Z0
G53 G0 X0 Y0 (go to door)
M125 (remove tool)
o502 endif
o<sub_progs/removetool> endsub
o<sub_progs/loadtool> sub
M108 P#<_hal[iocontrol.0.tool-number]> Q#<_hal[iocontrol.0.tool-prep-number]>
o504 if [#<_hal[iocontrol.0.tool-prep-number]> LE 12] (next tool in basket)
M108 P10 Q1
G0 G53 Z0
M112 (lower basket)
M118 (lower tool)
M114
S150 M3 (Spindel move slowly)
M113 (Raise basket)
M115
M111 (lock tool)
M5 (Spindel Sto)
M6 G43
o504 elseif [#<_hal[iocontrol.0.tool-prep-number]> GT 12] (next tool not in Basket)
M108 P10 Q3
M113 (Raise basket)
G53 G0 Z0
G53 G0 X0 Y0 (Go to door)
M126
M6 G43
o504 endif
M108 P10 Q4
o<sub_progs/loadtool> endsub
Thaks Patrick
Please Log in or Create an account to join the conversation.
31 May 2019 14:37 #135472
by bevins
Replied by bevins on topic Got some troubles with my tool change routines
I had the same issue with the z dropping before the brake kicked in.
I put a timer relay in to disable the drive disable for a second.
I put a timer relay in to disable the drive disable for a second.
Please Log in or Create an account to join the conversation.
31 May 2019 18:07 #135493
by anfänger
Replied by anfänger on topic Got some troubles with my tool change routines
Thanks, I already use a ladder for starting the cmc I think i just need to set in a timer that stops movement an spindle before cutting the power. As I said I don't see a big issue there.
Whats making me more trouble is the tool change. Cause I can't get the right Hal pin status for the new tool in ngc in time. And with command line I cant't move the machine. I tried mdi in command line but that doesn't work properly too.
Whats making me more trouble is the tool change. Cause I can't get the right Hal pin status for the new tool in ngc in time. And with command line I cant't move the machine. I tried mdi in command line but that doesn't work properly too.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5007
- Thank you received: 1441
31 May 2019 18:19 #135494
by Todd Zuercher
Replied by Todd Zuercher on topic Got some troubles with my tool change routines
M66 hal inputs are often useful for such things.
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m66
Please Log in or Create an account to join the conversation.
01 Jun 2019 00:01 #135512
by andypugh
Replied by andypugh on topic Got some troubles with my tool change routines
Are you running the stdglue.py routines as part of the remap? That should populate some G-code parameters with the info you need.
I agree that looking at the HAL pins in G-code will never work. Whatever you decide, that has to go.
github.com/LinuxCNC/linuxcnc/blob/master...dglue/stdglue.py#L92
self.params["tool"] = tool
self.params["pocket"] = pocket
So your G-code should be able to use #<tool> to get the tool number.
I agree that looking at the HAL pins in G-code will never work. Whatever you decide, that has to go.
github.com/LinuxCNC/linuxcnc/blob/master...dglue/stdglue.py#L92
self.params["tool"] = tool
self.params["pocket"] = pocket
So your G-code should be able to use #<tool> to get the tool number.
Please Log in or Create an account to join the conversation.
01 Jun 2019 17:45 #135580
by anfänger
Replied by anfänger on topic Got some troubles with my tool change routines
Thank I was able to fix it with the system parameters #<_selected_tool>. The script is running now.
Thanks everyone for helping
Thanks everyone for helping
Please Log in or Create an account to join the conversation.
Time to create page: 0.081 seconds