Feature Request - workpiece angle compensation CNC
-
@jay_s_uk I did in a seperate thread:
https://forum.duet3d.com/topic/25848/found-issues-using-duet-as-cnc-controller -
@dc42 okay great let me know if I can do something to help
-
-
@jrentschler01 please test G68 using one of the firmware binaries at https://www.dropbox.com/sh/4h5zqc0ki73wa9r/AABrMZxfMzMH4M0uJQPLsBmQa?dl=0.
Please note, these report the version as 3.4.0-beta6, however they are only candidates for the 3.4.0beta6 release. So please install the official beta6 when we release it.
I have tested basic G1, G2 and G3 moves with G68 and I believe they are working correctly. I have forbidden using G92 to set X or Y when G68 is in effect. I haven't taken account of G68 in any other situations - there may be some where RRF ought to.
The coordinate rotation defined by G68 is ignored when running system macros such as pause.g, resume.g, tool change and homing files.
-
@dc42 I tested now with G1 the same wy with drawing a simple rectangle and it worked so far, I assume G2&G3 as well. Thank you a lot.
I'm continue getting a macro ready to probe the workpice and calulate the angle like @jay_s_uk mentioned.It would be great if we could visualize it after that somehow.
-
@jay_s_uk said in Feature Request - workpiece angle compensation CNC:
@jrentschler01 i've written a macro.
this in theory should work but I haven't tested it yet.var y_first_measurement = 0 var y_second_measurement = 0 var y_length = 0 var x_first_measurement = 0 var x_second_measurement = 0 var x_length = 0 var y_over_x = 0 var y_x_tan_rads = 0 var y_x_tan_deg = 0 M291 P"Put the probe on the left hand side of the bottom edge" S2 X1 Y1 Z1 ; Pop up box asking for operator input M558 F1500 ; Set the initial probing speed G38.2 Y600 P0 K0 ; Probe the material as a first pass G1 Y{move.axes[1].machinePosition-5} ; Move 5mm away from the material M558 F150 ; Set the final probing speed G38.2 Y600 P0 K0 ; Probe the material again M400 ; Make sure all movement is complete set var.y_first_measurement=move.axes[1].machinePosition ; Record the stop position y_first_measurement set var.x_first_measurement=move.axes[0].machinePosition ; Record the stop position x_first_measurement M400 ; Make sure all data recording is complete G1 Y{move.axes[1].machinePosition-5} ; Move 5mm away from the material G1 X{move.axes[0].machinePosition+50} ; Move along the workpiece in X M558 F1500 ; Set the initial probing speed G38.2 Y600 P0 K0 ; Probe the material as a first pass G1 Y{move.axes[1].machinePosition-5} ; Move 5mm away from the material M558 F150 ; Set the final probing speed G38.2 Y600 P0 K0 ; Probe the material again M400 ; Make sure all movement is complete set var.y_second_measurement=move.axes[1].machinePosition ; Record the stop position y_second_measurement set var.x_second_measurement=move.axes[0].machinePosition ; Record the stop position x_second_measurement M400 ; Make sure all data recording is complete set var.y_length={var.y_second_measurement-var.y_first_measurement} set var.x_length={var.x_second_measurement-var.x_first_measurement} set var.y_over_x={var.y_length/var.x_length} set var.y_x_tan_rads=atan(var.y_over_x) set var.var y_x_tan_rads = degrees{var.y_x_tan_rads} G68 A0 B0 R{var.y_x_tan_rads}
Now this will ask you to jog to the bottom edge of your material, ideally you should go to somewhere near the bottom left.
This is of course assuming you're using a probe that can probe in X, Y and Z and its set as K0. I use a vers.by probe.
It uses G38.2 and stores the X and Y coordinates of each point. Once it probes the first point, it moves 50mm in X and probes again.
The angle is then calculated and fed into G68.
If you don't want to set it that way, its set usingG68 Ax Bx Rx
where Ax is the centre point to rotate around in X, Bx is the centre point to rotate around in Y and Rx is the angle to offset and is counterclockwiseHello,
Very good job so far.
I still get an error while running the macro.
"M292
Error: in file macro line 37 column 13: meta command: expected '='
"
Can somebody help me? -
@CanDo415 Can you share your firmware version?
-
@Phaedrux 3.4.1
-
@CanDo415 Please update to 3.5.1 and double check your macro that it matches the one shared. Particularly the line number the error reports.
-
@Phaedrux
copied the macro.
I have to fix all problems from the update first. Messed up my whole config -
"Error: in file macro line 37 column 12: meta command: unknown variable 'var'"
is the new result after updating to 3.5.1var y_first_measurement = 0 var y_second_measurement = 0 var y_length = 0 var x_first_measurement = 0 var x_second_measurement = 0 var x_length = 0 var y_over_x = 0 var y_x_tan_rads = 0 var y_x_tan_deg = 0 M291 P"Probe links vor das Werstück positionieren" S2 X1 Y1 Z1 ; Pop up box asking for operator input M558 F1500 ; Set the initial probing speed G38.2 Y600 P0 K0 ; Probe the material as a first pass G1 Y{move.axes[1].machinePosition-5} ; Move 5mm away from the material M558 F150 ; Set the final probing speed G38.2 Y600 P0 K0 ; Probe the material again M400 ; Make sure all movement is complete set var.y_first_measurement=move.axes[1].machinePosition ; Record the stop position y_first_measurement set var.x_first_measurement=move.axes[0].machinePosition ; Record the stop position x_first_measurement M400 ; Make sure all data recording is complete G1 Y{move.axes[1].machinePosition-10} ; Move 5mm away from the material G1 X{move.axes[0].machinePosition+50} ; Move along the workpiece in X M558 F1500 ; Set the initial probing speed G38.2 Y600 P0 K0 ; Probe the material as a first pass G1 Y{move.axes[1].machinePosition-5} ; Move 5mm away from the material M558 F150 ; Set the final probing speed G38.2 Y600 P0 K0 ; Probe the material again M400 ; Make sure all movement is complete set var.y_second_measurement=move.axes[1].machinePosition ; Record the stop position y_second_measurement set var.x_second_measurement=move.axes[0].machinePosition ; Record the stop position x_second_measurement M400 ; Make sure all data recording is complete set var.y_length={var.y_second_measurement-var.y_first_measurement} set var.x_length={var.x_second_measurement-var.x_first_measurement} set var.y_over_x={var.y_length/var.x_length} set var.y_x_tan_rads=atan(var.y_over_x) set var.var y_x_tan_rads=degrees{var.y_x_tan_rads} G68 A0 B0 R{var.y_x_tan_rads}
-
@CanDo415 i have a mistake in my macro. i have corrected my original
-
-
@CanDo415 i've made another change but I don't think its going to fix the issue.
I don't know why "degrees" throws an error though as its a built in command -
that's why i added Phaedrux.
I want to change it a bit to get the corner as well. so the degrees issue has to be solved anyway.
Thanks for the great start jay -
@dc42
maybe he can help? -
-
@droftarts
jay corrected it already.
the problem shifted to the degrees command -
@jay_s_uk said in Feature Request - workpiece angle compensation CNC:
@CanDo415 i've made another change but I don't think its going to fix the issue.
I don't know why "degrees" throws an error though as its a built in commanddegrees() is a function
You've used curly braces instead of parentheses
set var.y_x_tan_deg=degrees{var.y_x_tan_rads}
try
set var.y_x_tan_deg=degrees(var.y_x_tan_rads)
-
@OwenD i knew it would be something about the way its been formatted
updated the original again -
@OwenD
thank you for showing up the problem