The finite state machine moves from one state to another. There is one main observing PROGRAM, and one (or more?) main calibration PROGRAMs. Definitions of capitalised terms are:

  • PROGRAM: A set of tasks, executed in order.
  • WHEN: An if statement with a timeout.
  • EXCEPTION: When something doesn't go according to plans (usually a timeout), there has to be a backup plan. This could be e.g. try the next field and add to a nightly bad field count, or give up, close the dome and message someone.
  • ADDITIONAL_CALIBRATION_SCHEDULE: We should decide on a simple way to take extra calibrations in bad conditions. This is really a FunnelWeb thing - we want to be able to monitor instrumental drifts to increase RV precision.

Observing PROGRAM

This could be a master program, run in a loop with all other programs returning to this. Other architectures possible...
  • Check conditions.
  • WHEN conditions OK, ask scheduler for next object. [EXCEPTION: automatically execute additional Calibration PROGRAM according to ADDITIONAL_CALIBRATION_SCHEDULE]
  • WHEN next object obtained, check type of observation needed. If calibration is stale, execute Calibration PROGRAM first. With non-stale calibration, execute slew commands:
    1. Telescope -> slew
    2. Guider -> begin exposing
    3. Instrument -> configure (are there any moving parts? maybe not needed)
    4. Starbugs -> configure
  • WHEN slew complete and Starbugs configured, ask Guider if ready to guide.
  • WHEN Guider ready [EXCEPTION: Guider not ready, try spiral one time]:
    1. Guider -> Guide
    2. Instrument -> Expose
  • WHEN exposure complete, check if this observation needs Calibration PROGRAM at the end. Run this if needed.
  • WHEN (optional) calibration complete, send message to archiver task.
  • WHEN message acknowledged, return to start.

Calibration PROGRAM

  • Turn lamps on, put flaps/telescope in correct position.
  • WHEN everything in place, expose.
  • WHEN exposure complete, send message to archiver task.
  • WHEN message acknowledged, return to calling PROGRAM.