2

I want to eliminate the variables x and y from these 3 equations in a way that all parameters appear in one equation without x and y:

A : (x-xa + ta*xsa)^2 + (y-ya + ta*ysa)^2 + (1-xsa^2-ysa^2)*(ta+oa)^2 - rod1^2 = 0;
B : (x-xb + tb*xsb)^2 + (y-yb + tb*ysb)^2 + (1-xsa^2-ysa^2)*(tb+ob)^2 - rod2^2 = 0;
C : (x-xc + tc*xsc)^2 + (y-yc + tc*ysc)^2 + (1-xsa^2-ysa^2)*(tc+oc)^2 - rod3^2 = 0;

When I throw these equations into maxima and try to use eliminate([A, B, C], [x, y]) I get an out of memory error. If I use a simpler version ((x + a1)^2 + (y + a2)^2 + a3 = 0 etc) it works but the expression is incredibly long (many pages). I could substitute the parameters back into this but the result would still be incredibly long and messy as c code.

Is there a more compact version of the solution?

My math knowledge and skills are unfortunately limited and I don't have access to Mathematica.

I would very much appreciate any help how to solve this without having to study elimination theory.

Additionally I'll have to find the derivatives of the solution in regard to the different parameters.

Thank you!

What this is about:

I'm trying to write a program to automatically calibrate a DIY open hardware "linear delta 3D printer" (parallel robot) using numerical optimization. You can "probe" to find when your effector hits the bottom flat with z = 0 and use the machine coordinates ta/tb/tc of those points to optimize the parameters to minimize the positional error while printing. For a simpler case (without the xsa etc) this works beautifully, but for a more general case that allows for more build errors I run into the above problem. I'm using a lbfgs c library to optimize the solution and random restart to find a global minimum. I will publish the resulting program under MIT license.

ta, tb, tc: coordinates along the 3 towers of the robot
oa, ob, oc: max offsets of the robot arms on the top
rod1, rod2, rod3: the length of the robot arms
xa, ya, xb, yb, xc, yc: position of the bottom triangle additionally constraint by xb : -xa, yb : ya, yc : -2*ya
xsa, ysa, xsb, ysb, xsc, yxc: tilt of the towers in the x/y plane

A linear delta 3D printer

Dejay
  • 23

1 Answers1

1

I will try to give the solution in as compact form as I could find and explain the steps taken in order to be able to do so. But before reading on be warned that this will get messy!

The first thing I will do is to introduce some useful auxillary variables to simply the equations before solving them.

Let us start by defining effective radii

$$r_a^2 \equiv -(1-x_{sa}^2-y_{sa}^2)(t_a+o_a)^2 + \text{rod}_1^2$$ $$r_b^2 \equiv -(1-x_{sa}^2-y_{sa}^2)(t_b+o_b)^2 + \text{rod}_2^2$$ $$r_c^2 \equiv -(1-x_{sa}^2-y_{sa}^2)(t_c+o_c)^2 + \text{rod}_3^2$$

Note that $r_{a,b,c}^2 \geq 0$ is required in order to have a solution of the system. Next define effective centers

$$x_{aa} = x_a - t_a x_{sa}$$ $$x_{bb} = x_b - t_b x_{sb}$$ $$x_{cc} = x_c - t_c x_{sc}$$

$$y_{aa} = y_a - t_a y_{sa}$$ $$y_{bb} = y_b - t_b y_{sb}$$ $$y_{cc} = y_c - t_c y_{sc}$$

With these definitions your system becomes

$$(x-x_{aa})^2 + (y-y_{aa})^2 = r_a^2$$ $$(x-x_{bb})^2 + (y-y_{bb})^2 = r_b^2$$ $$(x-x_{cc})^2 + (y-y_{cc})^2 = r_c^2$$

and describes the intersection of three circles in the plane. A further simplification before starting to solve (the first two equations above) is to shift the origin of the coordinate system to $(x_{aa},y_{aa})$. This gives the system

$$X^2 + Y^2 = r_a^2$$ $$(X + x_{aabb})^2 + (Y + y_{aabb})^2 = r_b^2$$

where $X = x- x_{aa}$ and $Y = x- x_{bb}$ and where I (for the last time) have introduced some more variables:

$$x_{aabb} = x_{aa}-x_{bb}$$ $$y_{aabb} = y_{aa}-y_{bb}$$

(As you will see below, this is required in order to be able to write out the solution in full without using 7 pages to do so)

Now we are ready to solve the system (by hand or using software). The solution reads

$$x = x_{aa} - \frac{x_{aabb}(r_a^2 - r_b^2 + x_{aabb}^2 + y_{aabb}^2)}{2(x_{aabb}^2 + y_{aabb}^2)} \pm \frac{\sqrt{D}}{2(x_{aabb}^2 + y_{aabb}^2)}$$

$$y = y_{aa} - \frac{y_{aabb}(r_a^2-r_b^2 + x_{aabb}^2 + y_{aabb}^2)}{2(x_{aabb}^2+y_{aabb}^2)} \pm \frac{(-x_{aabb}/y_{aabb})\sqrt{D}}{2(x_{aabb}^2+y_{aabb}^2)}$$

where

$$D = -y_{aabb}^2(x_{aabb}^2 + y_{aabb}^2 - (r_a-r_b)^2)(x_{aabb}^2 + y_{aabb}^2 - (r_a+r_b)^2)$$

These expressions can now be inserted into the remaining equation

$$(x-x_{cc})^2 + (y-y_{cc})^2 = r_c^2$$

to give you what you want (you will have to determine which $\pm$-branch to pick). Note that if you were to code all this up then you could simply put all the definitions above in functions that take in your original variables as variables and return $y_{aa},x_{aabb},D,\ldots$ etc.

Winther
  • 25,313
  • Brilliant! Thank you very much :) This also includes the "forwardKinematic" and should make it easy to define the error function and the derivatives for the gradients simply by calculating x and y in each step. Wish I could upvote you more! – Dejay Jul 29 '14 at 02:51