Optical Calibration Demo and Three Hours Working on a Bug

I envision this process being used by the controller to refine the target coordinates so that the current calibration system produces the correct chain lengths. I believe we can use default values for those and get within reasonable range that the camera system can then develop a compensation matrix.

I think all we would need to do is have the user measure their distance between motors using a tape measure, select their linkage type from a list (ring, wooden, metal or custom value), enter an estimate for the motor offset, and an estimate for the weight of sled. The program would then use these values to come up with the calibration values. Then the user runs the optical calibration to generate the offset matrix.

So there’s no cutting required and the hand measurements taken are just the distance between motors and motor Y offset. Technically, even that doesn’t have to be all that accurate… just need to get it close enough so the correct square is within view of the camera all over the board

4 Likes

Neat! I think ‘compensation matrix’ is a great way to think about the problem. It reminds me of what the Prusa 3D printers are doing to correct for slightly out-of-square printers by using special inductive touchpoints on the bed.

Yeah, I have to give some props to @EdFeeney for spurring me back into working on this as I had completely put optical calibration on the back burner. His comments came at the right time as I was getting frustrated with the results of the “holey” calibration method and was unhappy with the accuracy I was still getting from my new frame, sled, and chains. Even though I don’t think we’ll use it, the time I spent on the “holey” calibration method and alternate chain sag calculations was worthwhile since I really got to understand how this thing worked…

@madgrizzle I just found out we have a 36x48" plotter here at the office. Any chance you can post your 36x48 version? I’m here in the office for the next 30 or so, but otherwise can print it Monday.

Working on it… sorry… have to load up a laptop

No rush I’ll just get it Monday! I’ve got some 11x17 ones printed I can use to test the basics

1 Like

calibrationPattern4x8-2.pdf (19.3 KB)

I couldn’t find the one I uploaded to Office Depot, so I printed a new one. Should be an ARCH E sized sheet

I reorganized the layout some. When you bring up the new version, you will see a place where you can enter top left point(x,y) and top right point (x,y). These points define the squares you are going to calibrate. X ranges from -15 to +15 and Y from +7 to -7. Top left corner square of the board (assuming a full sheet of squares) is -15, +7 and bottom right is +15, -7. Basically, to get physical dimensions, multiply those coordinates by 3. So -15, +7 is -45 inches, +21 inches. I put in some presets for different sheets. Let me know if you questions… Keep an eye on the thing… there’s still some latent bugs/uncaught conditions floating around. Weird things can happen if it can’t figure out the square.

So I need to measure my work piece to find the exact center and put a square right smack dab in the middle right? I ask because the center of my currently loaded plywood is a big circle cutout where i cutout my sled :slight_smile:

No need to be dead on for testing, but you need a square relatively close to what the machine thinks is center so the camera can see it completely. For testing, you can raise and lower what the machine thinks is center by changing your Motor Y Offset value, but there’s not much you can do to move it left or right.

At the end of the day, the sled has to return to center before you send the calibration data… Otherwise, you get a sled-not-keeping-up error… Like I mentioned before I think, it’s something on the todo list.

Bottom left quadrant of board…(all measurements in mm)

X Errors Prior to Calibration (really out of whack):

-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
0 6.287 4.769 4.892 3.93 3.635 3.135 2.898 2.339 2.106 1.755 1.506 1.132 0.72 0.381 0.153 0
-1 6.807 5.605 5.496 4.747 4.788 4.067 3.687 3.315 2.859 2.684 2.461 1.996 1.576 1.253 1.02 0.93
-2 6.579 6.635 5.513 5.134 4.634 4.292 3.871 3.557 3.21 2.892 2.641 2.172 1.651 1.477 1.225 1.113
-3 8.297 6.786 6.908 6.01 5.803 5.21 4.722 4.316 4.201 3.868 3.507 3.083 2.78 2.217 1.751 1.67
-4 7.296 8.01 6.698 6.328 6.021 5.552 4.854 4.567 4.223 4.003 3.665 3.183 2.86 2.425 2.147 2.131
-5 8.195 8.279 8.142 6.884 6.905 6.351 6.135 5.598 5.339 4.929 4.463 3.905 3.874 3.553 3.073 3.004
-6 10.975 7.702 8.671 7.291 6.748 6.725 5.936 5.939 5.472 4.979 4.472 4.532 4.275 3.641 3.328 3.315
-7 11.796 8.244 9.379 8.149 8.038 7.479 7.368 6.766 6.388 5.766 5.651 5.834 5.33 4.455 3.83 4.228

Y Errors Prior to Calibration (not as out of whack, but still out of whack):

-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
0 -4.181 -4.607 -3.877 -3.798 -3.376 -2.969 -2.565 -2.316 -1.943 -1.506 -1.317 -0.982 -0.836 -0.552 -0.509 0
-1 -4.375 -4.51 -3.947 -3.704 -3.303 -2.931 -2.54 -2.188 -2.003 -1.863 -1.672 -1.171 -1.011 -0.743 -0.519 -0.407
-2 -4.801 -3.715 -3.793 -3.406 -3.2 -2.724 -2.264 -1.931 -1.675 -1.637 -1.475 -1.018 -0.706 -0.431 -0.261 0.254
-3 -4.108 -4.567 -3.869 -3.358 -2.91 -2.801 -2.469 -2.126 -1.718 -1.668 -1.345 -0.98 -0.703 -0.414 -0.314 -0.286
-4 -4.633 -3.693 -3.659 -3.192 -2.87 -2.399 -2.106 -1.8 -1.712 -1.485 -1.146 -0.73 -0.515 -0.392 0.057 -0.051
-5 -4.596 -3.881 -3.415 -3.193 -2.718 -2.394 -1.866 -1.767 -1.254 -0.741 -0.367 -0.481 -0.553 -0.271 -0.041 0.452
-6 -3.063 -3.755 -2.84 -2.75 -2.922 -1.883 -1.819 -1.323 -0.762 -0.339 0.189 0.223 0.013 0.107 0.748 0.777
-7 -2.834 -3.874 -3.033 -2.609 -2.649 -2.163 -1.76 -1.209 -0.75 -0.015 0.481 0.15 0.201 0.264 0.843 1.268

X Errors after Calibration:

-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
0 -0.777 0.648 -0.352 0.159 0.01 0.078 0.012 0.073 0.01 -0.008 0.098 -0.01 0.063 -0.008 0.01 -0.013
-1 -0.881 0.287 -0.336 0.28 -0.328 -0.098 -0.095 -0.112 -0.138 -0.125 -0.093 -0.091 -0.068 -0.184 0.056 -0.297
-2 0.209 -0.843 0.213 -0.193 0.309 -0.04 0.063 0.016 0.029 0.03 0.018 -0.029 0.059 0 -0.013 0.017
-3 -1.388 0.709 -0.368 0.282 -0.282 -0.097 -0.191 0.006 -0.13 -0.083 -0.071 -0.024 -0.302 -0.107 0.015 -0.154
-4 1.819 0.056 0.503 -0.272 0.144 0.107 0.194 0.1 0.077 0.072 -0.022 -0.006 0.018 0.099 0.137 0.005
-5 -0.083 0.423 -0.842 0.17 -0.416 -0.14 -0.685 -0.278 -0.502 -0.309 -0.401 -0.119 -0.383 -0.299 -0.264 -0.203
-6 -0.116 1.733 -0.563 0.046 0.74 0.086 0.823 0.228 0.293 0.366 0.386 0.267 -0.091 0.244 0.405 -0.118
-7 -0.083 -0.324 -0.003 0.201 -0.677 -0.155 -0.786 -0.24 -0.361 -0.405 -0.022 -0.687 -0.279 -0.412 0.074 -0.408

Y Errors after Calibration:

-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0
0 -0.724 0.359 -0.222 0.174 -0.114 -0.103 -0.061 -0.071 -0.097 -0.145 0.104 -0.201 0.068 -0.207 0.094 -0.082
-1 -0.306 0.361 -0.156 0.315 -0.081 0.021 0.062 0.033 0.088 0.024 0.026 0.037 0.054 0.144 -0.033 0.031
-2 0.279 -0.306 0.152 -0.063 0.119 -0.192 -0.116 -0.011 -0.053 -0.022 -0.045 -0.031 -0.083 -0.116 -0.149 -0.595
-3 -0.578 0.598 -0.052 0.181 -0.18 -0.011 -0.016 0.203 -0.191 0.022 -0.002 0.097 0.165 -0.009 -0.133 0.333
-4 0.542 -0.012 0.08 -0.057 -0.052 -0.007 0.017 -0.079 -0.05 -0.123 -0.036 -0.107 -0.085 0.01 -0.581 0.113
-5 0.452 0.641 -0.015 0.358 -0.08 0.243 -0.088 0.285 -0.214 0.122 0.058 0.004 0.122 -0.194 0.431 -0.257
-6 -0.006 0.744 -0.415 -0.298 0.368 -0.285 0.18 -0.063 -0.112 -0.153 -0.233 -0.133 0.287 0.187 -0.246 -0.105
-7 0.17 0.465 0.164 0.378 0.344 0.154 0.077 0.246 0.343 -0.093 -0.383 0.354 -0.239 0.279 0.076 -0.113

I don’t have any skirt so there might be something up with a couple of the values. Nevertheless, I think this process will work.

3 Likes

        //set flag to ignore position error limit during the tests
        sys.state = (sys.state | STATE_POS_ERR_IGNORE);

You can turn that error off… look at the code handling ‘B04’ in GCode.cpp for instance. Just remember to turn it back on when you’re done :wink:.

I think its a little deeper… The controller recalculates its position based upon the new calibration matrix. It knows where it is, but whenever you do that and are away from center, I think some residual value of its previous position (or something) is still in memory and when it calculates a move, it throws this error.

I found vista print has 4x8 foot banners printed on smooth vinyl for $69 delivered in about a week. So I gave it a shot. Not sure what the quality of the pattern it will be. Will see.

B04 moves the motors too. At its end it updates with the current encoder values.

I’m getting set up to try this out. Anything specific you want me to try @madgrizzle? Or just see how replicatable it is for me?

I need to flash the firmware too right? Looks like you have some changes in there, at least for saving the calibration matrix.

OK so it can track the squares just fine, but I don’t think the calibration is sticking (flashed the firmware with the version in your repo). Here’s what I’m doing:

  1. Open Optical Calibration
  2. Click ‘Calibrate’
  3. Click each of the 9 ‘Move To:’ buttons waiting until the values populate on the right each time.
  4. Click ‘Save and Send’ (I’m getting a bunch of error: Bad number format in the gcode console)
  5. G0 X0 Y0
  6. Verify that the sled is aligned with the center square now (it is not)

Ok i just pulled your repo and reflashed etc (I think I may have flashed the stock firmware when I was getting the above error). But with the latest version I’m not sure what to click to get the sled to move to the different positions to calibrate (since the 3x3 buttons are gone now)

Edit: duh it is ‘Auto Home’. Did that work in the last version too? I couldn’t get it to do the right thing.

1 Like