Machine Position Correction Planar Compensation available to try out.

Moderator: cnckeith

713cnc
Posts: 26
Joined: Tue Jul 16, 2024 3:41 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: Yes
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Contact:

Re: Machine Position Correction Planar Compensation available to try out.

Post by 713cnc »

After doing some surgery on my CNC and upgrading the motors to clearpath (finally), I am back to the point of setting up Vol. comp.
Something seems off to me. Say all my tables are empty except for 4 th column of cnc-y.tab ( X compensation). I am compensating the X axis when jogging in the y direction (Skewness of the table). At y=0.5" my x compensation is 0.1. If I go to set x=0 in G54, the DRO display shows .1

Is this normal? I would want it to show 0.

Edit: Before upgrading to clearpath motors, I added linear magnetic scales. I left them on to test even though the clearpath have a feedback loop because why not, I did the work and the wiring and they are there. Turns out if your scales are enabled, setting x=0 in work coordinate sets it equal to the compensation amount there. Turning them off, and the behavior is now as expected. Setting x=0 then displays 0.

Would it be a good idea to accomodate scale feedback AND volumetric compensation by adding the compensation amount to the scale amount in the display so that setting x=0 then displays 0 in x?

For now I am turning off the scales.
Attachments
report_0008DC111213-1120230151_2025-07-29_17-52-41.zip
(1.25 MiB) Not downloaded yet


713cnc
Posts: 26
Joined: Tue Jul 16, 2024 3:41 am
Acorn CNC Controller: No
Plasma CNC Controller: No
AcornSix CNC Controller: Yes
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No
Contact:

Re: Machine Position Correction Planar Compensation available to try out.

Post by 713cnc »

Due to the warp in my table, I really could use bi-directional compensation rather than a simple sum of the offset taken at a single value.
I dial in z when crossing the table at, say, the midpoint of the table and it works great, but then I need a whole other set of compensation values at different values at the front and back of the table.

When you do bed mesh leveling on a 3d printer, I think Marlin uses bi-linear interpolation:
https://en.wikipedia.org/wiki/Bilinear_interpolation
https://github.com/MarlinFirmware

Here is chatGPT's suggested code:

Code: Select all

def cubic_interp(p, x):
    # p = [p0, p1, p2, p3]
    return (
        p[1]
        + 0.5 * x * (p[2] - p[0]
        + x * (2*p[0] - 5*p[1] + 4*p[2] - p[3]
        + x * (3*(p[1] - p[2]) + p[3] - p[0])))
    )

Code: Select all

def bicubic_interp(grid, x, y):
    i = int(x)
    j = int(y)
    dx = x - i
    dy = y - j

    # Collect the 4x4 surrounding grid of values
    values = []
    for m in range(-1, 3):
        row = []
        for n in range(-1, 3):
            # Clamp indices to grid bounds
            ii = max(0, min(i + m, len(grid) - 1))
            jj = max(0, min(j + n, len(grid[0]) - 1))
            row.append(grid[ii][jj])
        values.append(row)

    # Interpolate in x for each row
    col = [cubic_interp(row, dx) for row in values]

    # Interpolate the resulting column in y
    return cubic_interp(col, dy)

Code: Select all

# Example 2D grid (Z values)
Z = [
    [0, 1, 2, 3],
    [1, 2, 3, 4],
    [2, 3, 4, 5],
    [3, 4, 5, 6]
]

# Interpolate at (x=1.5, y=1.5)
z_interp = bicubic_interp(Z, 1.5, 1.5)
print(z_interp)


Post Reply