Hello Guest it is March 29, 2024, 03:16:19 AM

Author Topic: perpendicular gantry software calibration  (Read 1955 times)

0 Members and 1 Guest are viewing this topic.

perpendicular gantry software calibration
« on: November 18, 2016, 08:27:38 AM »
Hi All,

I have a CNC router with a gantry (X axis) that show about  0.2 degree missing of orthogonality with the longitudinal long axis (Y).  The router is a large size (1500x5100x300 mm cutting area) and the gantry is around 300 kg, so not easy to dismount to check where is the problem. Because the angle miss alignment is large, and given the 1800 mm distance from the supports, this translate in moving the gantry of several mm (about 7 mm) impossible to do without re-drilling the gantry.  Otherwise, the machine is accurate enough.  So looking for a software solution, I would like to implement a change in coordinates so every time I type or the G code ask to position the x,y it will result in a x',y' instead, using a shear mapping i.e. the actual movement will be x' = x+my; y'=y where m is the cotangent of the angle of miss alignment.  Have anyone of you some suggestion how to implement such a coordinate transformation ?


Thank you!
Re: perpendicular gantry software calibration
« Reply #1 on: December 01, 2016, 04:22:45 AM »
Hi matteo,
I've had the same problem with my mill which had the X and Y axis out of square by about 4min of arc.
Prior to me stripping down the mill and making the required plate to correct the issue I used software
to make the correction.

As you probably know there is a formula page on the 'Function Cfg's' menu which will do that calculation.
The problem arises though that Mach does not apply the formula equally at all times. What happens is
for instance is that a correction is calculated but requires a significant movement and Mach responds
by trying an instantaneous move of several mm and fails because of limited acceleration. If you're using
steppers they stall and all bets are off. I have not seen any real explanation that can describe the circumstances
when it occurs but a number of users have seen and not be able to explain it either.
What I did was to write a macro that wrote a new file with the arithmetic correction and the ran that and it
worked a treat. In reality it was a wizard of sorts but as I was just starting to use VB I was happy with anything
that worked.

This is what I used

 Sub main
Dim origname$,modname$,pathname$,currline$
Dim correction#
pathname="C:\Users\craig\Documents\eagle\lvdt4\lvdt4."


 Begin Dialog filenameinput 16,30,180,96,"filename input"
 OKButton 132,20,40,14
 Text 8,8,32,8,""
 TextBox 8,20,100,12,.inputname
 End Dialog
 Dim Dlg1 As filenameinput
 Dialog  Dlg1
origname=pathname & Dlg1.inputname
modname=pathname & "CORRECTED" & Dlg1.inputname
correction=-0.004
Open origname For Input As #1
Open modname For Output As #2
While Not EOF(1)
Line Input #1, currline
posx=InStr(1,currline,"X")
If posx=0 Then
Print #2,currline
Else
posy=InStr(1,currline,"Y")
posendy=InStr(posy,currline," ")
xstring=Mid(currline,posx+1,posy-posx-2)
ystring=Mid(currline,posy+1,posendy-posy)
xstring=xstring+ystring*correction
leftstring=Left(currline,posx)
rightstring=Right(currline,Len(currline)-posy+1)
newstring=leftstring &  xstring & " " & rightstring
print #2,newstring
End If
wend
End Sub           


As you can see the first part (very inelegant though it be) was just getting the file
to be corrected and generating the name of the corrected file.
The substantive part is where it reads a line, extracts the X and Y cords,calculates the
corrected X coord along the same lines you proposed (xstring=xstring+ystring*correction)
then puts the line back together as a string and sends it to the new or corrected file.
The only real challenge is getting the fairly limited string functions in VB to accommodate
your requirements. The file dialog I've used is a dog and hope I could do better now than then!

This approach means that cords in your Gcode match the numbers in your CAD while
you are optimising your Gcode and the just prior to running the code make the correction
not unlike a post processor I suppose.

Some ideas for you.

Craig
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'