\documentclass{article}
\usepackage{graphicx}
\usepackage{a4wide}
\usepackage{url}
\newcommand\graad{\ensuremath{^\circ}}
\begin{document}
\noindent \textbf{\Huge Math of the delta style 3-D robots}\\
{\small Written by Bas Wijnen $<$\url{wijnen@debian.org}$>$}
\section{Introduction}
There are several different types of 3-D printers. The Delta type has a lot of
benefits. This article discusses some of the computations that are required for
using it.
\subsection{The delta system}
First it is important to understand how the machine works, and to define the
terms that are used throughout this document.
The machine has three vertically moving carriages. These are called u, v and w.
The carriages connect with two rods each to the effector: a platform holding
the print head, which can be positioned by moving the carriages. Because both
rods in each pair are the same length, and they are connected at equal
distances on both sides, each pair forms a parallelogram. Because of this, the
effector is always horizontal.
For simplification of the computations, the model that is used to describe this
system is adjusted in a way that does not change the outcome of the
computations:
\begin{itemize}
\item The effector is assumed to have zero size. This means that all
the rods connect to the same point, which is the effector.
\item A pair of rods is assumed to be a single rod. This means that
each pair only has one length, which had to be true anyway for
the effector to be parallel.
In practice, if the lengths are measured accurately and they
differ slightly, pairs should be chosen to be as close to equal
as possible and the length of the pair should be the average of
the two.
\end{itemize}
Positions in space have 3 coordinates and are written as $(x, y, z)$. The
origin of the machine is in the center of the build platform. The x axis is
parallel to the line through the u and v carriages (when at equal height, and
if their radii are equal), where from u to v is the positive x direction. The
positive y axis intersects the path of the w carriage. The lines from the
origin are orthogonal to the paths of the carriages and make angles of
120\graad{} with each other.
The radius of a carriage is the distance from the origin to the path of that
carriage.
At the top of the machine are limit switches. They are used to prevent the
carriage from moving up past the mechanical limits, and to calibrate its
position. The switch position is the distance from the switch to the position
of the carriage when the effector is at the origin.
Summarizing: the settings that define a delta machine are three rod lengths,
three radii and three switch positions.
% TODO: Clarify all this with an image.
\section{Moving the effector}
When the effector needs to move, the position in space is known, and the
carriage positions need to be computed. This is fairly easy:
\begin{enumerate}
\item For each carriage, find the horizontal distance from the carriage to the effector target position.
\item Compute the base position of each carriage using $base=\sqrt{rodlength^2-distance^2}$
\item Add the target $z$ position to all carriage positions.
\end{enumerate}
\section{Finding the effector}
There are several uses for the reverse: with known carriage positions, the
effector position should be computed. For example, this can be used for
calibration. The motor positions are measured for a number of positions where
the effector is on the build platform, and the machine settings are changed so
that at those motor positions the effector is indeed at a z position of 0.
This operation is a lot harder. Figure \ref{scad} schematically shows it. The
effector is known to be at a fixed distance (the rod length) from each
carriage. This means it must be on a sphere of that radius, centered at the
carriage. Those are the large transparent spheres in Figure \ref{scad}. The
intersection between two spheres is a circle. The intersection of this circle
with the final sphere is two points: one for which the rods are pointing up,
and one for which they are pointing down. The down pointing solution is the
effector position.
\begin{figure}[hbtp]
\includegraphics[width=.8\textwidth]{scad.eps}
\caption{Schematic of the operation of finding the intersection of
three spheres.}
\label{scad}
\end{figure}
\subsection{Intersection of two spheres}
The intersection of two spheres is a circle. This can be defined by its normal
and its radius. When viewing a plane through the centers of both spheres, there
is a line going straight between the centers, and a line from each center to
the intersecting circle. This results in two triangles, as shown in Figure
\ref{spheres}.
\begin{figure}[hbtp]
\includegraphics{spheres.eps}
\caption{Schematic of the points of interest in the intersections of
two spheres. A and B are the sphere centers, C is on the intersecting
circle, and D is the center of that circle. The circle itself is
perpendicular to the page.}
\label{spheres}
\end{figure}
Spheres with centers A and B have radii of AC and BC respectively. D is the
center of the intersecting circle. CD is its radius.
For finding the intersecting circle $C_{uv}$, A and B are known, as are AC and
BC. The goal is to find D and CD. Since this is an arbitrary view, C is any
point on the circle and cannot be uniquely found. However, given AD as the
normal of the circle, D as the center and CD as the radius, the circle is fully
defined.
\begin{eqnarray}
AD^2&=&AC^2-CD^2\\
BD^2&=&BC^2-CD^2\\
AD^2-BD^2&=&AC^2-BC^2\\
BD&=&AB-AD\\
AD^2-(AB-AD)^2&=&AC^2-BC^2\\
2AD\cdot AB-AB^2&=&AC^2-BC^2\\
AD&=&\frac{AC^2-BC^2+AB^2}{2AB}\\
&=&\frac{AC^2-BC^2}{2AB}+\frac{AB}2\\
D&=&A+AD\\
CD&=&\sqrt{AC^2-AD^2}
\end{eqnarray}
This method is first used to find the intersecting circle (orange) of the spheres around
u (red) and v (green). The center of this circle (red) is called $P_{uv}$, the
radius is $r_{uv}$ and the normal is $n_{uv}$.
Then the intersecting circle $C_{uvw}$ (blue) of the sphere around $P_{uv}$ with
radius $r_{uv}$ and the sphere around w (blue) is computed. The center of it
(blue) is called $P_{uvw}$, the radius is $r_{uvw}$ and the normal is
$n_{uvw}$.
Because the two intersecting points of circles $C_{uv}$ and $C_{uvw}$ are on
both the circles, the line $L$ between them (green) is perpendicular to both
their normals. This means that the direction of $L$ can be found using the
cross product of $n_{uv}$ and $n_{uvw}$.
If $n_{uv}$ and $n_{uvw}$ are not orthogonal, $L$ is offset from $P_{uvw}$. The
angle $\alpha$ between $n_{uv}$ and $n_{uvw}$ can be found using the definition
of the cosine: $\cos\alpha=\frac{n_{uv}\cdot n_{uvw}}{|n_{uv}|\cdot |n_{uvw}|}$.
The angle between $n_{uvw}$ and the plane of $C_{uv}$ is $90-\alpha$. The
offset must have a length of the tangent of $90-\alpha$ in the direction
orthogonal to both $n_{uvw}$ and $L$, which can be found using the cross
product. In Figure \ref{scad} this is shown as the grey line and sphere.
Using the cosine of the inverse sine, the position of the intersection on $L$
can be found. This is the small green sphere in Figure \ref{scad}.
\end{document}