Thursday, 24 April 2014

Fun with Domes (PART 3)

This is where I start delving deeper into the mathematics behind the dome control algorithms. After all this it was a good week before I stopped having dreams about spherical polar coordinate transforms.
The way the dome works out where to point to match a given mount position relies on a whole load of mathematics. The actual implementation of that maths is a bit fiddly but the principals behind it are fairly straightforward. It goes something like this:


1. Calculate where the camera in use is relative to the centre of the dome. Call the vector that gets you from the centre of the dome to the camera m.
 2. Work out a second vector which is just some vector in the direction the camera is looking. Call this vector d.
 3. Now it is possible to describe any and all points along the line of sight of the camera by taking the vector m and adding to it some multiple of the vector as in the example to the left.

This can be expressed mathematically by the vector equation of a line
r = m + td (where t is a number that can take any value from 0 upwards)
 4. Next we ask the following question: "How much of d do we need to add to m so that the place we get to is on the edge of the dome?"

(Mathematically that is what value of t do we require such that |+ td| = Rdome)

5. It is then fairly simple to work out what exactly this point that lies on the dome is and then to move the dome so that the centre of the dome is on this point.








The problem with this is that it assumes that the dome is very thin. It assumes that, if the line of sight goes through the centre of the dome gap, that the dome will be centred within the image, however the outer extremity of the dome may not be centred even if the innermost part is.

We had the idea that if we changed the dome radius value in the algorithm to be half-way between the inside and the outside, that it would give a better position for the dome. I ran simulations for the whole sky with different radii. (Each simulation run takes my work laptop 6 hours to complete, for various reasons, so this took a while).

The image below shows what the visibility looked like to start with, with green being image 100% sky and red being image 2/3 sky or less. Hover over it to see how this changed with an increased radius parameter.

Hover to see the improvement with larger dome radius
The improvement was really good. The radius was changed in the code in the control server to match my simulations and the images returned by the telescope the first few nights after the change were very promising.

I still wasn't satisfied though. I had invested a lot of time in this endeavour so far and the resulting solution, though effective, was not very elegant. We were still assuming that the dome was a thin sphere, just a larger one. And we had some thoughts that perspective effects due to the wide angle of the camera would also be skewing things. But this I will talk about in my next and final post...

Click here for part 4