Project Splinescan
QUICKLINKS: OVERVIEW

The scanner uses some fairly basic trig. to calculate the x,y,z co-cordinates of any particular point. The way the scanner uses maths is not complicated, but it does take some thought to figure out which calculations are done where, and why.

CATCHING SOME Z

The laser line projects on a rotating object. This is captured in 2D and stored in memory. The first step is to take the 2D lines and revolve them around the y-axis to generate a sort of 'spline cage' - that is a series of splines that revolve around 360 degrees to form a cage.

The general formula for rotation around the y-axis is:

Y = y
X = z(sin(r)) + x(cos(r))
Z = z(cos(r)) - x(sin(r))

Where X,Y, Z are the new spatial co-ordinates, x,y,z are the old spatial co-ordinates and r is the angle of rotation around the y-axis.

However, the 3D scanner is starting from a 2D image - this means we can assume that the old z co-ordinate is always 0 degrees. so the formula becomes:

Y = y ----> Y = y
= 0(sin(r)) + x(cos(r)) ---->> X = x(cos(r))
Z = 0(cos(r)) - x(sin(r)) ----> Z = - x(sin(r))

SLIGHTLY ABOVE AVERAGE

One of the big problems with using a laser as the problem of speckle. Laser speckle occurs when light is reflected off a surface. Because not all photons bounce in the same way, the laser line can appear to shimmer and shift. The most obvious way around this is to take a number of samples and average the input.

MOTOR CONTROL

The motor used in the scanner has a 200 step accuracy. That means that the motor can position itself in 200 discrete positions around a 360 degree turn. This is not particularly limiting in turns of accuracy, and it is possible to make an interpolated scan with many more discrete samples. More of this will be discussed later. All you need to know for now is that the motor's step angle is 360/200 = 1.8 degrees.

SNIPPETS:

GOING TO PYTHON
The splinescan project is being redesigned from the ground up using PYTHON. I tried experimenting with C but in the end, the programming started to overtake the project, and was becoming inaccessible. Python is an interpreted language, runs on most platforms, is easy to learn and is ideally suited to the scanner project.

V4L
The capture system uses streamer to gather data - While V4L programming was ok to do, there is very little need to reinvent the wheel and streamer does exactly what the project needs it to do.

© Wednesday 07th of January 2009 11:57:07 AM - Andrew Lewis