RunAO is issued after a successful Preset in adaptive mode to acquire the reference star and start the AO loop.
If pseudo-monocular, mark passive side command as bad, to force a warning later.
Return error if not authorized.
Return error if a a RunAO command is already in progress.
Return error if no active Preset.
Return error if not in adaptive mode.
Generate local rePoint flag. Note that the RunAO rePoint condition may be overridden on the IIF control GUI. The operator may elect to force telescope repointing, forbid repointing, or allow the instrument supplied flag to decide.
Ignore and return warning if command is from passive side pseudo-monocular instrument.
Return error if any needed subsystems are not running. The PCS and AOS are always needed. The GCS is needed for focal stations BENTGREGORIANFRONT, BENTGREGORIANARGOS, BENTGREGORIANREARFIBERFEED, and DIRECTGREGORIAN.
Return success If the AO loop is already closed.
Tell GCS to stop sending centroids to PCS and Zernikes to PSF. Return error if GCS reports failure.
If rePoint flag is true, pause guiding. Return error if GCS reports failure.
If SKIPREF is false, invoke AcquireRefAO in the AOS. Do not check for error.
If rePoint flag is true, tell GCS that an offset has occurred. Return error if GCS reports failure.
If rePoint flag is true, resume GCS guiding. Return error if GCS reports failure or if AOS reported failure in step 7.
If SKIPSTART is false, invoke StartAO in the AOS. Return error if AOS reports failure. Return success.
If step 5 succeeded and the command has failed the GCS is told to re-start sending centroids to PCS (if simplemode is MODE_GUIDE or greater) and Zernikes to PSF (if simplemode is MODE_ACTIVE).
If command is error or warning, make events from CommandReturn results.