\hypertarget{ATT_8h}{
\section{ATT.h File Reference}
\label{ATT_8h}\index{ATT.h@{ATT.h}}
}
LAT Attitude Processing Package.  


{\tt \#include \char`\"{}ATT/ATT\_\-msg.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/WCT.h\char`\"{}}\par


Include dependency graph for ATT.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=110pt]{ATT_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=104pt]{ATT_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Attitude Processing Control Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ \hyperlink{ATT_8h_a1}{ATT\_\-get} (void)
\begin{CompactList}\small\item\em Get pointer to attitude processing global handle. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a2}{ATT\_\-init} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl, unsigned int num\-Secs)
\begin{CompactList}\small\item\em Initialize global attitude processing handle. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a3}{ATT\_\-exit} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl)
\begin{CompactList}\small\item\em Shutdown the attitude processing global handle. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a4}{ATT\_\-reset} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl)
\begin{CompactList}\small\item\em Reset the attitude processing global handle. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a5}{ATT\_\-update} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl, const WCT\_\-time t, const double $\ast$Q, const float $\ast$W)
\begin{CompactList}\small\item\em Update attitude history list. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a6}{ATT\_\-lookup} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl, const WCT\_\-time t, double $\ast$Q)
\begin{CompactList}\small\item\em Lookup attitude information in history list. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a7}{ATT\_\-range} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl, WCT\_\-time $\ast$t\-Bottom, WCT\_\-time $\ast$t\-Top)
\begin{CompactList}\small\item\em Get current time range of history list. \item\end{CompactList}\item 
unsigned int \hyperlink{ATT_8h_a8}{ATT\_\-xform} (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ctl, const WCT\_\-time t, const double $\ast$Vl, double $\ast$Vj)
\begin{CompactList}\small\item\em Trasform a vector from LAT coordinates to J2000 coordinates. \item\end{CompactList}\end{CompactItemize}
\subsection*{Vectory Utility Functions}
\begin{CompactItemize}
\item 
void \hyperlink{ATT_8h_a9}{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-rad} (const double $\ast$Vc, double $\ast$Vs)
\begin{CompactList}\small\item\em Transform a cartesian vector to spherical (ra,dec) coordinates (radians). \item\end{CompactList}\item 
void \hyperlink{ATT_8h_a10}{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-deg} (const double $\ast$Vc, double $\ast$Vs)
\begin{CompactList}\small\item\em Transform a cartesian vector to spherical (ra,dec) coordinates (degrees). \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
typedef \hyperlink{struct__ATT__Control}{\_\-ATT\_\-Control} \hyperlink{ATT_8h_a0}{ATT\_\-Control}
\end{CompactItemize}


\subsection{Detailed Description}
LAT Attitude Processing Package. 

\begin{Desc}
\item[Author:]D.L. Wood\end{Desc}
This library contains functions and definitions for manipulating and transforming vectors in LAT instrument body coordinates to vectors in J2000 coordinates. The ultimate goal is to produce a vector in J2000 coordinates (RA, DEC) for any given cartesian vector in LAT local coordinates.

The attitude information is input in the form of an attidude state vector which consists of a:

\begin{enumerate}
\item Timestamp as a 64-bit WCT value\item Four element SC-J2000 attitude quaternion\item Three element SC angular velocity vector\end{enumerate}


This information is provided to the LAT from the SC GNC system. The attitude library maintains a short time history of the attitude information to allow for vector transformations at arbitrary times in the recent past. Call the function \hyperlink{ATT_8h_a5}{ATT\_\-update()} to inform the attitude processing software of a new message available from the SC.

\subsection{Typedef Documentation}
\hypertarget{ATT_8h_a0}{
\index{ATT.h@{ATT.h}!ATT_Control@{ATT\_\-Control}}
\index{ATT_Control@{ATT\_\-Control}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-Control]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__ATT__Control}{ATT\_\-Control}}}
\label{ATT_8h_a0}


The type for the global attitude processing control descriptor. 

\subsection{Function Documentation}
\hypertarget{ATT_8h_a3}{
\index{ATT.h@{ATT.h}!ATT_exit@{ATT\_\-exit}}
\index{ATT_exit@{ATT\_\-exit}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-exit]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-exit (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl})}}
\label{ATT_8h_a3}


Shutdown the attitude processing global handle. 

This releases any global resources allocated in the call to \hyperlink{ATT_8h_a2}{ATT\_\-init()}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A ATT MSG code.\end{Desc}
\hypertarget{ATT_8h_a1}{
\index{ATT.h@{ATT.h}!ATT_get@{ATT\_\-get}}
\index{ATT_get@{ATT\_\-get}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-get]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ ATT\_\-get (void)}}
\label{ATT_8h_a1}


Get pointer to attitude processing global handle. 

This function returns a pointer which may be passed as a parameter to the other functions in this library. The function \hyperlink{ATT_8h_a2}{ATT\_\-init()} must be called for this pointer before the other library functions are available.

\begin{Desc}
\item[Returns:]A pointer to the global instance of the attitude processing control structure.\end{Desc}
\hypertarget{ATT_8h_a2}{
\index{ATT.h@{ATT.h}!ATT_init@{ATT\_\-init}}
\index{ATT_init@{ATT\_\-init}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-init]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-init (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl}, unsigned int {\em num\-Secs})}}
\label{ATT_8h_a2}


Initialize global attitude processing handle. 

This function initializes the global attitude processing control state.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure. \item[{\em num\-Secs}]The number of seconds backwards to maintain in the attitude history list.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A ATT MSG code.\end{Desc}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=105pt]{ATT_8h_a2_cgraph}
\end{center}
\end{figure}
\hypertarget{ATT_8h_a6}{
\index{ATT.h@{ATT.h}!ATT_lookup@{ATT\_\-lookup}}
\index{ATT_lookup@{ATT\_\-lookup}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-lookup]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-lookup (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl}, const WCT\_\-time {\em t}, double $\ast$ {\em Q})}}
\label{ATT_8h_a6}


Lookup attitude information in history list. 

This function looks up the information stored for time {\em t\/} in the attitude history list.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure. \item[{\em t}]The timestamp for the attitude information. \item[{\em Q}]SC-J2000 quaternion for time {\em t\/} is placed here on successful return:\par
 Q\mbox{[}0\mbox{]} = q1 (x) \par
 Q\mbox{[}1\mbox{]} = q2 (y) \par
 Q\mbox{[}2\mbox{]} = q3 (z) \par
 Q\mbox{[}3\mbox{]} = q4 (w) \par
.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]An ATT MSG code.\end{Desc}
\hypertarget{ATT_8h_a7}{
\index{ATT.h@{ATT.h}!ATT_range@{ATT\_\-range}}
\index{ATT_range@{ATT\_\-range}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-range]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-range (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl}, WCT\_\-time $\ast$ {\em t\-Bottom}, WCT\_\-time $\ast$ {\em t\-Top})}}
\label{ATT_8h_a7}


Get current time range of history list. 

This function looks up current range of times in the attitude history list.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure. \item[{\em t\-Bottom}]Stores the bottom (earliest) time from the history list. \item[{\em t\-Top}]Stores the top (latest) time from the history list.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]An ATT MSG code.\end{Desc}
\hypertarget{ATT_8h_a4}{
\index{ATT.h@{ATT.h}!ATT_reset@{ATT\_\-reset}}
\index{ATT_reset@{ATT\_\-reset}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-reset]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-reset (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl})}}
\label{ATT_8h_a4}


Reset the attitude processing global handle. 

This clears the attitude history list current entries and resets the history list to its initial state.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A ATT MSG code.\end{Desc}
\hypertarget{ATT_8h_a5}{
\index{ATT.h@{ATT.h}!ATT_update@{ATT\_\-update}}
\index{ATT_update@{ATT\_\-update}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-update]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-update (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl}, const WCT\_\-time {\em t}, const double $\ast$ {\em Q}, const float $\ast$ {\em W})}}
\label{ATT_8h_a5}


Update attitude history list. 

This function updates the tail of the attitude history list.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure. \item[{\em t}]The timestamp for the attitude information. \item[{\em Q}]SC-J2000 quaternion for time {\em t\/}. \par
 Q\mbox{[}0\mbox{]} = q1 (x) \par
 Q\mbox{[}1\mbox{]} = q2 (y) \par
 Q\mbox{[}2\mbox{]} = q3 (z) \par
 Q\mbox{[}3\mbox{]} = q4 (w) \par
. \item[{\em W}]The SC angular velocity vector for time {\em t\/} (units rad/sec). \par
 W\mbox{[}0\mbox{]} = wx \par
 W\mbox{[}1\mbox{]} = wy \par
 W\mbox{[}2\mbox{]} = wz \par
\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]An ATT MSG code.\end{Desc}
\hypertarget{ATT_8h_a10}{
\index{ATT.h@{ATT.h}!ATT_vec_cart_to_sphr_deg@{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-deg}}
\index{ATT_vec_cart_to_sphr_deg@{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-deg}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-deg]{\setlength{\rightskip}{0pt plus 5cm}void ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-deg (const double $\ast$ {\em Vc}, double $\ast$ {\em Vs})}}
\label{ATT_8h_a10}


Transform a cartesian vector to spherical (ra,dec) coordinates (degrees). 

Transforms the vector {\em Vc\/} in (x,y,z) cartesian coordinates into the vector {\em Vs\/} in (ra,dec) spherical coordinates. {\em Vs\/} is returned in degrees.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em Vc}]The input vector in cartisian coordinates. \par
 Vc\mbox{[}0\mbox{]} = x \par
 Vc\mbox{[}1\mbox{]} = y \par
 Vc\mbox{[}2\mbox{]} = z \par
\item[{\em Vs}]The output vector in spherical coordinates. \par
 Vs\mbox{[}0\mbox{]} = ra \par
 Vs\mbox{[}1\mbox{]} = dec \par
\end{description}
\end{Desc}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=168pt]{ATT_8h_a10_cgraph}
\end{center}
\end{figure}
\hypertarget{ATT_8h_a9}{
\index{ATT.h@{ATT.h}!ATT_vec_cart_to_sphr_rad@{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-rad}}
\index{ATT_vec_cart_to_sphr_rad@{ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-rad}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-rad]{\setlength{\rightskip}{0pt plus 5cm}void ATT\_\-vec\_\-cart\_\-to\_\-sphr\_\-rad (const double $\ast$ {\em Vc}, double $\ast$ {\em Vs})}}
\label{ATT_8h_a9}


Transform a cartesian vector to spherical (ra,dec) coordinates (radians). 

Transforms the vector {\em Vc\/} in (x,y,z) cartesian coordinates into the vector {\em Vs\/} in (ra,dec) spherical coordinates. {\em Vs\/} is returned in radians.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em Vc}]The input vector in cartisian coordinates. \par
 Vc\mbox{[}0\mbox{]} = x \par
 Vc\mbox{[}1\mbox{]} = y \par
 Vc\mbox{[}2\mbox{]} = z \par
\item[{\em Vs}]The output vector in spherical coordinates. \par
 Vs\mbox{[}0\mbox{]} = ra \par
 Vs\mbox{[}1\mbox{]} = dec \par
\end{description}
\end{Desc}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=167pt]{ATT_8h_a9_cgraph}
\end{center}
\end{figure}
\hypertarget{ATT_8h_a8}{
\index{ATT.h@{ATT.h}!ATT_xform@{ATT\_\-xform}}
\index{ATT_xform@{ATT\_\-xform}!ATT.h@{ATT.h}}
\subsubsection[ATT\_\-xform]{\setlength{\rightskip}{0pt plus 5cm}unsigned int ATT\_\-xform (\hyperlink{struct__ATT__Control}{ATT\_\-Control} $\ast$ {\em ctl}, const WCT\_\-time {\em t}, const double $\ast$ {\em Vl}, double $\ast$ {\em Vj})}}
\label{ATT_8h_a8}


Trasform a vector from LAT coordinates to J2000 coordinates. 

This function transforms a vector {\em Vl\/} input in LAT instrument coordiates into a vector {\em Vj\/} in J200 coordinates. The timestamp {\em t\/} is used to lookup the attitude information in the global history list. The SC-J2000 quaternion returned by the lookup is then applied to {\em Vl\/} to produce {\em Vj\/}. The timestamp should correspond to the time at which the transform for {\em Vl\/} should be performed.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ctl}]A pointer to the ATT global control structure. \item[{\em t}]The timestamp for the attitude information. \item[{\em Vl}]Input vector in LAT coordinates. \par
 Vl\mbox{[}0\mbox{]} = x \par
 Vl\mbox{[}1\mbox{]} = y \par
 Vl\mbox{[}2\mbox{]} = z \par
\item[{\em Vj}]Output vector in J2000 coordinates. \par
 Vj\mbox{[}0\mbox{]} = x \par
 Vj\mbox{[}1\mbox{]} = y \par
 Vj\mbox{[}2\mbox{]} = z \par
\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]An ATT MSG code.\end{Desc}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=231pt]{ATT_8h_a8_cgraph}
\end{center}
\end{figure}
