# I am struggling with some math (surprise, surprise!)

I have figured out how to square up my RepRap 3d Printer with my ROMER arm. I am just unable to do the math to make it happen.

If I take a total of 12 XYZ points. 4 on the print bed with it all the way forward, 4 with it all the way back, and then 1 point on the X carriage with it in the 4 extremes of it's movement, I can calculate how square each axis is to each other.

I just need to transform the input data into a new coordinate system so my mind can make sense of the points.

A-B should be along the X axis and A-D should be along the Y axis. This is called an alignment – I am just redefining the coordinates to something on the printer as opposed to those captured by the measuring device.

Rotated thusly, I can look at C and know if it's high or low. I can also look at EFGH and know if my print bed is tracking correctly. IJKL can be tweaked to be perpendicular to the print bed's travel using actual, real measurements of adjustment.

I remember matrices from college. I remember flunking the class they where in repeatedly. I remember changing majors to something that doesn't require that class. I've looked for some example spreadsheets, downloaded them, and they are as opaque to me now as they where back then.

I need a spreadsheet where I enter my 12 XYZ coordinates, and next to them I get the transformed points. The calculations should happen below on that sheet. Could somebody help me (read as 'make this for me')?

## Join the Conversation

1. Hmm, read it twice. Not following exactly what you need. Maybe if I knew what you are trying to accomplish by having these coordinates? What are your physically trying to do?

2. Not sure what a ROMER arm is. Google says it is kind of like a Robotic Arm. Is this for plotting? Or is it for point clouding or something?

3. The ROMER arm is a portable Coordinate Measurement Machine. It provides XYZ points in space. I work for the company that makes them. They guys I have access to just let the software we have do the math for them.

I can use the arm to determine coordinates of movement of my printer. Basically track the movement of the 3 axis in 3d space.

Once I know this, I can use the spreadsheet to calculate the perpendicularity of the 3 axis. i.e. determine if the X & Y aren't actually perpendicular, see if the Z is actually going straight up in relation to the print bed, as opposed to the table the printer is sitting on.

I hope to be able to measure and tweak based on the printer's carriage movements, and not just the frame.

4.  – Ok… I see now. I am gonna think for a minute.

5. What kind of units do you want to use? You want you use mm right? Is the arm providing coordinates in mm?

6. mm Yes. Although the math really would be dimensionless.

7. I don't have a data set at the moment, but I will capture one tonight.

8. I am onto something, have you ever read Nophead's blog? He is prominent RepRapper…. anyway, here is an article where he does auto bed-leveling. Basically, he has a z-probe that measures the bed at three points, and then translates the coordinate system on the fly for the print. He has links to how he figured all the math there, if you are interested.

http://hydraraptor.blogspot.com/2011/04/auto-bed-leveling.html

Anyway, I am working on it.

9. I love HydraRaptor. It's actually a significant contributor for me getting a RepRap.  I'd read that article a long time ago. Forgotten about it.

His technique addresses an unlevel bed on an otherwise good frame.

I am trying to make sure that the Y tracks straight with no twist, along with the X&Z.  If some of the Y brackets are over-tightened they can stretch. This can cause the Y to roll as it travels as the rods aren't parallel to each other in the Z axis.

10. What he does there is take three sample points from his z probe, and makes those points 0,0,0. So that means the code he shows there has the formula for translating any point described in his g-code to that new coordinate system.

This is essentially what you need to do. Your, probe is your ROMER arm of course.

11. Yeah, I think I want to set A to 0,0,0; B to Bx – Ax, 0, 0; and D to 0, Dy-Ay, 0.

That might be the missing piece I need to make the example I linked to above work for me.

12. Yep, I'm pretty sure you need to define at least three points in each coordinate system.

13. SUCCESS!!! I was able to convince somebody to do it for me! Thanks  I owe you yet MORE printed parts!

The numbers I am seeing in the spreadsheet and the geometric flaws in a test print are consistent, so I think I validated this approach.

Now, to finish fixing my printer based on my spreadsheet!

14. I've added some calculations for 'suggested movements' based on the squareness calculations. It actually helped square up a resulting print! I still have some more thinking and tweaking to do with the numbers to make it more correct.