Optical Calibration Demo and Three Hours Working on a Bug

I found this on amazon today while looking for something else… Maybe it would work? Not too expensive, but gotta pay $17 for shipping.

I’m not sure if the numeric grid would be accurate enough though.

Edit: or something like this:


Once again, I’m not sure on the grid spacing, but worth looking at maybe.

1 Like

I still think that AR codes at specific points should be sufficient, which I suggested earlier.

  1. Get 3mm (1/8") sheet of MDF or something. Attach it to the machine at a fixed and repeatable location.
  2. Attach some AR code stickers at various points on the board. Measure the actual position of each sticker and its ID.
  3. Move sled around and use camera to calculate centroid and orientation of AR code sticker, and detect ID of AR code.
  4. Record the machine’s reported position for each AR code.
  5. Iterate* until the machine’s reported position matches the measured position, remembering to account for the orientation of the AR sticker (as seen), and the offset from the camera to the router axis.

Once the calibration is done remove the AR code board and run the machine until it needs to be recalibrated/checked again. Advantages: AR stickers are small and easy to produce, measurement accuracy is as good as you want it to be, you can attach as many stickers as you want and interpolate positions between them. Disadvantages: many, I’m sure.

  • Yes, I know, this could mean anything, however, if you have the machine’s reported coordinate and you know the actual physical coordinate you can (handwave) and you’re done.

I think you are underestimating the ability to accurately measure the position
of each sticker.

you could just put a big + in various places and then measure them with the
existing code (with slight modifications to let you enter the positions) if you
can be accurate enough on how you measure where they are.

for that matter, if you can measure positions accurately enough, there’s no need
to use a camera at all, just drill a grid and measure the positions of the holes
(reversing the process) and the tell the system the difference between the two.

David Lang

@Madgrizzle I know your optical calibration ends up with a matrix of correction
factors. Could you modify the code so that it can be a set of “machine thinks
it’s at X1,Y1 but it’s actually at X2,Y2” tuples. That way the same mechanism
can work if someone has an accurate grid and centers the router on it, or if
they make an inaccurate grid and measure the actual locations.

I believe the rest of your math will remain the same, just with the difference
in the input format.

Then we can have people try various methods and see how they work.

David Lang

The thing about AR codes is that you can tell which location you are at, which helps to automate things. If you have a grid of + signs or holes then you won’t know which one you are looking at (they all look the same), so you have to prompt the operator.

I imagine measuring the sticker position would be as accurate as you want it to be. Put the 3mm MDF on a table. Start in one corner with a square and a tape measure and note down the position of each sticker. If the measurements are inaccurate or out of square do them again. Humans have been able to draw straight perpendicular lines for a while now.

I also think that only a few points would be needed to check/verify the calibration of the machine. The centre, for sure, then 8 other points minimum- top left, top centre, top right, centre left, etc. More is better, but you get diminishing returns after a while. Remember, even without anything like this at all the machine cuts pretty accurately.

Does anyone have a sense of the relationship between grid “density” and Maslow accuracy? That is, if I calibrate with a grid of 1 foot (~300 mm) squares, how much worse is my accuracy in the spaces between than if I calibrate with a grid of 1 inch (~25.4 mm) squares? I’m sure there are diminishing returns going with a tighter grid.

If I understand the question correctly, “yes, sort of” should be the answer. Optical calibration currently works by the “machine is at x1, y1 but to get there, I had to tell the machine to go to x2, y2”, which is really the same as to what you stated.

Right now optical calibration has two methods… error matrix and curve fit. In error matrix, two regularly spaced 2D arrays (x1, y1 values) contains the correction values x2-x1, y2-y1, respectively. The firmware uses interpolation to determine how much correction needs to be applied to intermediate locations not precisely on the nodes of the grid. If you had an array (list) of tuples you could conceivably interpolate/extrapolate the values from the list to create the regularly spaced arrays which will then be used by the controller. For curve fitting, an array (list) of tuples would work fine because its just taking data points in.

My biggest concern is how accurate someone can measure X,Y locations of arbitrary points. But that’s the basis of holey maslow… measure distances from multiple points and then solve for x,y based upon those distances. I struggled with it in practice and moved to optical calibration to remove my measurement inaccuracy from the equation.

I imagine measuring the sticker position would be as accurate as you want it
to be. Put the 3mm MDF on a table. Start in one corner with a square and a
tape measure and note down the position of each sticker. If the measurements
are inaccurate or out of square do them again. Humans have been able to draw
straight perpendicular lines for a while now.

sure, but to what precision? we are aiming for sub-mm precision and that’s hard
for humans to do, especially over such distances

I also think that only a few points would be needed to check/verify the
calibration of the machine. The centre, for sure, then 8 other points minimum-
top left, top centre, top right, centre left, etc. More is better, but you get
diminishing returns after a while. Remember, even without anything like this
at all the machine cuts pretty accurately.

what you are missing is that the standard calibration works by having a model of
the machine and uses a few points to try and modify variables in that model.

optical calibration works by assuming the model is wrong and instead it
creates a grid of known points and the error between the real world and the
model at those points. Then it ‘corrects’ it’s location based on this grid.
Since the errors are curves of different shapes in different directions
(depending on the type and size of the different errors), you can’t just take a
few points and use them with the optical calibration approach.

the holey triangulation approach relies more on the model and so it is achieving
it’s accuracy from 6 holes (and 11 measurements between them + 1 to the top of
the sheet)

David Lang

1 Like

No, there hasn’t been enough experimentation yet.

David Lang

1 Like

If I understand the question correctly, “yes, sort of” should be the answer.
Optical calibration currently works by the “machine is at x1, y1 but to get
there, I had to tell the machine to go to x2, y2”, which is really the same as
to what you stated.

right, and I’m wanting to be able to say “I told the machine to go to x2, y2 and
it really went to x1, y1”

same sort of data but with yours the x1y1 values are a nice grid and the x2y2
values wander, but I want to make sure that we can have x2y2 be a nice grid and
the x1y1 values wander.

This should mostly be checking to make sure that there are no hidden assumptions
that either side is a nice grid (or the size of the grid).

Right now optical calibration has two methods… error matrix and curve fit.
In error matrix, two regularly spaced 2D arrays (x1, y1 values) contains the
correction values x2-x1, y2-y1, respectively. The firmware uses interpolation
to determine how much correction needs to be applied to intermediate locations
not precisely on the nodes of the grid. If you had an array (list) of tuples
you could conceivably interpolate/extrapolate the values from the list to
create the regularly spaced arrays which will then be used by the controller.

could it be made to work with irregularly spaced arrays? find the 4 points that
surround you and interpelate from them? (probably by assuming that the error is
linear within the distorted box)

this would include potentially having different grid spacing in different areas.

I could see someone wanting to have a very accurate grid in the center of the
machine, but allow for a bigger, less accurate grid out near the edges.

or the method I mentioned offhand a few posts up where you have a very accurate
grid to measure, but it’s small, so you get points from it in one place, shift
it so there is overlap of the old and new locations, map the new location of the
grid based on the error matrix generated by the first location (extending your
known accurate area, but where the points measured by the second location are
rotated and at an odd offset from the poitns measured at the second location)

For curve fitting, an array (list) of tuples would work fine because its just
taking data points in.

how complex can the curves be? (is that an input parameter?)

My biggest concern is how accurate someone can measure X,Y locations of
arbitrary points.

I agree with the concerns.

Part of what I am thinking is to try and make a set of instructions to let
people try all these various methods they are proposing and see how they work in
the real world. It’s frustrating for all parties for people to post ideas and
for me to be the critic saying why they may not work. (and I will be wrong some
of the time and shoot down an idea that will work, which is why I try to give my
reasoning rather than just being the authority saying “this is a bad idea”)

But that’s the basis of holey maslow… measure distances
from multiple points and then solve for x,y based upon those distances. I
struggled with it in practice and moved to optical calibration to remove my
measurement inaccuracy from the equation.

Actually we have three approches here

  1. (holey) input grid, modify machine dimensions to best fit the errors
    no run-time correction

  2. (optical matric), input grid,
    runtime: calculate ‘correct’ coordinates given desired location and known
    nearby errors (may be able to correct for a simplified or incomplete machine model)

  3. (optical curves), input grid, map error curves
    runtime: calculate ‘correct’ coordinates given desired location and error
    curves (may be able to correct for a simplified or incomplete machine model)

The question of how to generate the grid is somewhat orthoginal to the question
of how you use the data. you started the optical approach to simplify taking the
measurements and I’m looking to decouple how to generate the error matrix from
how to use the error matrix

For Example:

A) make it so that you could use optical means to measure a grid and use the
holey approach to compute the ‘correct’ machine dimensions to match that.

B) make it so that people can measure a grid of points and use the matrix or
curve apporach to correct errors on the fly.

To do this, we would need to make all three approaches able to handle an
arbitrary size input grid that is not assumed to be regular in either real-world
or desired locations. (I think you are really close, if not already there)

This also means that we need to merge your firmware changes into the mainline.
As per the this tangent we are drifting on, the ability to use an error matrix
or error curve is independent of the way the error matrix is generated, so let’s
make it so that people can experiment. I think we will end up finding tricks
that we didn’t imagine.

David Lang

I do have a tendency to get ‘grand visions’ of generalizing things, and it’s not
unusual for me to want to generalize things beyond what the developers are
willing to do.

I’ve got a lot of years working with unix, where a couple of the common
mantras are ‘provide mechansim, not policy’ and ‘losely coupled tools that each
focus only on being the best mechansim’

As a result of this, I tend to break down systems into the mechansims and try to
make them as independent as possible. It makes me a good systems guy who can
make things work, but you really don’t want to use the user interfaces that I
create :slight_smile:

That’s part of the reason I try to make the mechanisms independent of the UI, so
I can have my nice clean low-level tools while others who are better at the UI
make a usable UI for it

David Lang

  1. Place we stickers or tape on the board. (Or maybe even random sharpie squiggles)

  2. Take a picture of the board and use image recognition to “code” the “grid”.

  3. Load the data to the optical calibration.

  4. Allow me to manually update the measurement between any 2 points.

  5. Create a implies accuracy factor for each square in the grid.

how good is your camera"

across 8’ of board, a 20MP camera will get about 1/2mm per pixel (~5k horizontal
resolution), for accurate measurements and positioning, you need about 4-5x that
so you would need to have a 100MP camera.

Then there is the question of your lens. How much distortion is there in your
lens? that will affect your image recognition of the grid positions.

trying to get high resolution measurements at long distances is non-trivial,
doing it on a budget is HARD. we are trying for accuracy on the order of 1-2 in
10,000. This is like trying to measure a mile with an accuracy of ± 3 inches or
the length of your football field to a ±1/2"

by the way, what you are suggesting is exactly what we were thinking would work
initially.

I had a rather long post responding and deleted it most of it as I moved through the message.

The challenge is time and effort… There was a lot of hours put into it to just get optical calibration where it is and I think it will be a lot of hours to get to where we can do what you suggest… and then, assuming that someone actually does try to use it (because that was my concern a while ago about making a lot of changes that no one would bother to even try it) the hours working with them to figure things out, sort out bugs, answer questions… It’s a lot man. :slight_smile:

I take short walks everyday and think about scaling back and focusing on one, maybe two, things. Wife, twins and 19-year old that moved back home and all the things that entails… And then there’s work that could get extraordinarily busy at any moment to prevent me from being as “responsive” as I’ve been during the day.

So, @bar seems to be working on a four motor design and so I’m thinking about shelving my work on my design. That would give me my motors back so I could have an actually function Maslow. @bar and @blurfl seem to be working on a new controller that’s focused on esp32 + spi so I’m probably going to stop focusing on the work I did with the teensy. Webcontrol that could use some love to get holey calibration working in it and I think it’d be fun to work on getting webcontrol functionality into esp32grbl if its possible. Doesn’t leave a whole lot of time for optical calibration.

1 Like

Combining the location codes with the tyvek idea seems to present a very compelling solution.

I suspect a coded grid could be professionally printed on 4 foot wide tyvek type material. Other than mounting it squarely to the spoil board there shouldn’t be too many sources of human error. So the camera would always know where it is because it has its motor position and can compare with discrete location positions encoded in the bar codes or QR codes.

It seems that would meet the general requirements as articulated? Large format and professionally labeled positions with full data easily pulled from each mark without the camera code having to make assumptions about location. Cheap to ship and fairly light and easy to install with push pins.

Maybe the QR is a fixed dimension like 20x20mm to aid in precision?

Jeff

A related and perhaps parallel question I would like to find an answer to is:

Given the available current frame designs and calibration models, what is the accuracy and repeatability over a smaller optimal area. And is that area on center?

Said another way, can we provide high accuracy as a 6’x3’ Maslow without requiring material changes to the hardware or software?

As the Nemi ships proved, if it is hard to raise the boat sometimes it is easier to lower the lake.

A potential approach is in messaging. Expect X accuracy inside this boundary box (6x3) and falling accuracy outside it, unique to your setup.

Where boundary wise on the 4x8 can we currently deliver high accuracy consistently for users who follow the build instructions fairly closely?

-Jeff

I support you in whichever direction you want to work. I love seeing the things you make! You starting to work on the 4 motor design got me excited about the idea and being able to bounce ideas off of you inspired what I’m working on. Your teensy port and work with Web Ground Control is what pushed me in the esp32 direction to get the benefit of both.

If you are going to work on an esp32 port of web Ground Control I would love to help because that is basically what I am working on. Let me know and we can start a new thread

1 Like

I think a new thread would be good. I’d love to collaborate on anything and everything assuming I can make it work with RL. I just don’t want to be duplicating efforts… competitive tracks are great when there’s plenty of time, resources, and energy… I’m lacking in all three areas :slight_smile:

2 Likes

Awesome :+1::+1::+1: I will create a GitHub repo and a thread about it in the morning. We can lay out our goals and form a plan there

2 Likes