Subs::Attitude (version $)

Extract attitude data. Swift attitude data appears in several places in the telemetry. This subroutine collects all the attitude data into a single quaternion- based attitude file and removed redundant information. The main source of attitude data is the "ACS packets" (APID 404). The BAT also places ACS records in the headers of each LDP and in the body of a special LDP generated suring slews. The XRT places ACS records in the header for each CCD frame, however these are represented by "floats" instead of "doubles", so they are not used if higher accuracy data are available. The sub checkDatabaseForNominalPointing reads the database file "/sw/nominal_pnt.rdb" from the directory indicated by env var $RDB_TABLES_DIR (normally set in aps.config; defaults to /aps/db/rdb/tables). If the sequence is found in this table, those values are used for the nominal pointing; this allows for manual override when the pointing cannot be reliably determined automatically. Otherwise, the mean pointing is calculated and compared with the requested pointing (SACSREQ, read from the engineering housekeeping file), if these disagree an E2 error is logged and an email notification is sent. Currently the tolerance is 10 arcmin. Someone should then review the sequence and add the correct position to nominal_pnt.rdb, then rerun the sequence. Here is a pseudocode outline of the algorithm used to determine the nominal attitude: IF obs in ADB [nominal pointing database] pnt_db = ADB[obs] ELSE pnt_sacs = determineSACSREQ(sw<obs> # 1-2% of the time, determineSACSREQ fails... pnt_aspect = aspect(sw<obs>[pu]at.fits) IF pnt_sacs AND pnt_aspect THEN IF separation(pnt_sacs, pnt_aspect) > 10 arcmin THEN E2 ERROR SACSREQ and aspect positions inconsistent SEND EMAIL NOTIFICATION ENDIF IF minRollDelta(pnt_sacs, pnt_aspect) > 2 deg THEN E1 ERROR ENDIF ELSEIF pnt_aspect IF pnt_aspect has ERROR E2 ERROR Unable to determine nominal pointing SEND EMAIL NOTIFICATION ENDIF ENDIF ENDIF

Parent Classes: Subs::NominalPointing, Subs::SwiftSub