Sunday, April 27, 2008

Coudé Flat Control

Implementing some of the pulpit controls has required rewriting some of the existing control functions. That's somewhat annoying, although I tried to improve them while I was at it.

The Coudé Flat controls are a good (bad?) example. The crane rotates down and places the flat on the central support column. Then it releases the flat and rotates back up again. The base of the flat is one model: it can rotate back and forth 90 degrees, between the default South-looking orientation, which reflects light toward the Coudé room, and an East-looking orientation, which reflects light toward a spectrograph in the telescope's East arm. The Coudé Flat mirror assembly is a separate model: it can either be at a fixed 45 degree tilt, for reflecting into the East arm, or it be manually or automatically tilted so it continuously reflects light toward the Coudé room as the telescope changes its Declination angle.

Previously the crane was a single model, separate from the models comprising the Coudé flat. None of the parts of the crane model moved, so in V2 its clamping mechanism passes (inappropriately) through the models of the flat when the crane rotates up after placing the flat on the central support.

However, the Pulpit includes a control for the crane's clamping mechanism. V3 now has two crane models. One of them includes a complete model of the flat, with the crane's clamping mechanism holding it securely. The other crane model has the clamping mechanism in the released position, so it'll clear the mirror's models as the crane rotates up and away. In other words, selecting the Pulpit's "place mirror" switch swaps the two crane models and changes the visibility of the parts of the mirror models that are on the support column.

I very briefly considered animating the clamp release. However, the crane has too many articulated pieces; some of them rotate, some translate and some do both. Each of them would require separate ScriptedOrbit and ScriptedRotation functions, carefully adjusted to match their motions with those of the other pieces. Maybe someday Celestia will implement animated bones (models which are constrained to stay in proximity in specified ways). Then I'll consider redoing this.

As a side-effect, I also had to redo how the Coudé flat model was controlled. That isn't entirely finished: I haven't done the code for the switch that moves control from the Pulpit to the Desk. Currently both are active simultaneously.

Here's a picture of the crane when it has just released the Coudé flat on the central support. Note the state of the Pulpit controls.


No comments: