Author Topic: Problem with LinuxCNC PP  (Read 18076 times)

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1996
    • View Profile
    • pixelmaker
Problem with LinuxCNC PP
« on: September 29, 2022, 08:45:49 am »
Hello
I have a problem here on the table from a German user.
He uses LinuxCNC as controller.
For the tool measurement he needs a M600 instead of the M6 command.
This is defined in the tool change section of the PP, instead of M6.
The M600 is also output cleanly in the PP.
However, the direction of rotation of the spindle (M3) becomes a modal command through the output of the M600.
As soon as M600 is output, M3 is no longer output in the following mops, only in the first mop.
When the direction of rotation changes, M4 is output, which is actually correct.

I know that the commands M3, M4 and M5 are modal commands.
A new output in the following Mop should not be necessary, CamBam does it anyway.
That is the theory. But since I have never worked with this before and also don't have LinuxCNC, I am unsure. Is there a way to make CamBam output the direction of rotation (M3/M4) in each Mop anyway?
Is an NC programme sure to have M3 output only in the first mop.
Can M3 be lost when a program is interrupted or paused?

ralf

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7597
    • View Profile
    • Cambam V1.0 French Doc
Re: Problem with LinuxCNC PP
« Reply #1 on: September 29, 2022, 15:01:14 pm »
Quote
As soon as M600 is output, M3 is no longer output in the following mops, only in the first mop.

If I remember correctly the hacks I had done on the tool change macro, CamBam needs the M6 to manage the tool change, if no M6, it does not know that there is a change of tool.

If you want an M3 in front of each mop, you can replace the {$spindle} by M3 in the mop macro.

{$comment} {$mop.name} {$endcomment}
{$toolchange}
{$velocitymode} {$workplane}
{$mop.header}
{$spindle} {$s}
{$blocks}
{$mop.footer}

become

{$comment} {$mop.name} {$endcomment}
{$toolchange}
{$velocitymode} {$workplane}
{$mop.header}
M3 {$s}
{$blocks}
{$mop.footer}

Hope that help

++
David

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1996
    • View Profile
    • pixelmaker
Re: Problem with LinuxCNC PP
« Reply #2 on: September 29, 2022, 18:41:03 pm »
Hello David
A fixed M3 is used at the moment. This only means that you always have to use cw milling cutters. I have never used a ccw milling cutter in my life, but it would be nice if everything worked.
LinuxCNC does not switch on the spindle if the M3 is not output in the following mop. There could be an error in the tool change macro. I don't have LinuxCNC and can't try it out.

I have now found an article where M6 is mapped to the M600 subroutine (tool measurement).
Then it seems that the M600 only has to be called once at the beginning of the programme, then the M6 command works.
As written, this is unfortunately all theory, because I don't have LinuxCNC and for me all the Linux hacking is also a bit of a mystery.

Thank you
ralf

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7597
    • View Profile
    • Cambam V1.0 French Doc
Re: Problem with LinuxCNC PP
« Reply #3 on: September 29, 2022, 20:05:03 pm »
Quote
I don't have LinuxCNC and for me all the Linux hacking is also a bit of a mystery.

 ;D me too !

++
David

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1896
    • View Profile
Re: Problem with LinuxCNC PP
« Reply #4 on: September 30, 2022, 00:07:37 am »
Ralf the M600 is a 3Dprinting code to change the colour of the filament. (It's kinda a tool change).
There's a wealth of Info here:

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?ManualToolChangeMacro#:~:text=The%20existing%20file%20is%20called%20%22hal_manualtoolchange%22%20and%20if,be%20executable%20or%20simply%20alter%20the%20original%20file.

From the manual:

Quote
Steps to use the manual tool changer in Axis
Add the following lines to your .hal file

 loadusr -W hal_manualtoolchange
 net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
 net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
 net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
 net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
Program a line similar to this to use:

 M6T1
At the end of the .ngc file program this to remove the tool

 M6T0
Axis "remembers" what tool is loaded. So a M6Tn of the same number will not prompt for another tool change. The "T" number must be different. If you want to pull out the tool and put it back put a M6T0 between...

If the OP has a router\mill then use the standard input system for tool changes. (the tool change macro) and modify it to suit his requirements.

You can modify\re-define M and G codes as in the example of modifying a G74.

http://wiki.linuxcnc.org/cgi-bin/wiki.pl?G74_-_Peck_Drilling/Face_Grooving

I note that here at CB (and the drilling plugin) we don't have to do any of this, as the controller
has been abstracted away by using plain Gcode that all Gcode interpreters can understand, meaning no modification to the controller macro's.

Dave

Offline pixelmaker

  • CNC Jedi
  • *****
  • Posts: 1996
    • View Profile
    • pixelmaker
Re: Problem with LinuxCNC PP
« Reply #5 on: September 30, 2022, 11:25:07 am »
Hello Dave
In Marlin, M600 is used for filament change.
The M600 command initiates the filament change procedure.


In LinuxCNC, M600 is used to call a subroutine for dynamic tool measurement after a manual tool change.

The user has now tried to output the M600 directly via the G-code generated by CamBam. For this purpose, the M6 was replaced with M600 in the tool change.
This also works, but CamBam then no longer outputs M3 in the following mop. (?¿ why)
This led to the spindle not starting after the tool change.

As I have written, LinuxCNC is not my world. For me, the main thing was that M3 was not output. Everything that happens behind this in LinuxCNC I only know from other descriptions.
M3 is a modal command for me. Once set, it must actually hold.

After reading LinuxCNC stuff for a few hours, much without understanding it, I found the article in the LinuxCNC forum.
https://forum.linuxcnc.org/forum/10-advanced-configuration/5596-manual-tool-change--tool-lengh-touch-off?start=30#48235
There M6 is mapped via some ini-file in LinuxCNC with M600.
M600 only has to be called once at the beginning of the program, then the tool change can be triggered normally with M6, then the tool is measured.
This seems to be the solution to the problem for the user.

What I don't understand is that after changing the M6 to another value, CamBam no longer outputs the M3 in the following Mop.
This seems to be a bug in CamBam.
Unfortunately, I have pretty much given up hope of fixing bugs in CamBam.
After 3 Years from the last version I can no longer tell any user that anything will be fixed in a future version.

So I can only look for workarounds and try to keep the users with CamBam.
This is already quite frustrating for me.

ralf

Offline dave benson

  • CNC Jedi
  • *****
  • Posts: 1896
    • View Profile
Re: Problem with LinuxCNC PP
« Reply #6 on: September 30, 2022, 14:44:58 pm »
HI Ralf
The M600 is not a tool change macro like M6, it is a user defined macro.
It’s defined first in the ini file and then called in the tool change macro, it has to be defined
first
to be used and this is why cambam doesn't recognise it, as it’s not in the standard.
Manual Toolchange with tool length offset - LinuxCNC
If you scroll through the code file file and read down a little further, they display the code to do this.
I did try a file and got the same result as you, and this is why.

Dave