\section{aversive\_\-10-03-12/modules/devices/control\_\-system/control\_\-system\_\-manager/control\_\-system\_\-manager.c File Reference}
\label{control__system__manager_8c}\index{aversive\_\-10-03-12/modules/devices/control\_\-system/control\_\-system\_\-manager/control\_\-system\_\-manager.c@{aversive\_\-10-03-12/modules/devices/control\_\-system/control\_\-system\_\-manager/control\_\-system\_\-manager.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$control\_\-system\_\-manager.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf DEBUG}~0
\item 
\#define {\bf debug\_\-printf}(args...)~do \{ \} while(0)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf cs\_\-init} (struct {\bf cs} $\ast${\bf cs})
\item 
void {\bf cs\_\-set\_\-consign\_\-filter} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t($\ast$consign\_\-filter)(void $\ast$, int32\_\-t), void $\ast$consign\_\-filter\_\-params)
\item 
void {\bf cs\_\-set\_\-correct\_\-filter} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t($\ast$correct\_\-filter)(void $\ast$, int32\_\-t), void $\ast$correct\_\-filter\_\-params)
\item 
void {\bf cs\_\-set\_\-feedback\_\-filter} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t($\ast$feedback\_\-filter)(void $\ast$, int32\_\-t), void $\ast$feedback\_\-filter\_\-params)
\item 
void {\bf cs\_\-set\_\-process\_\-in} (struct {\bf cs} $\ast${\bf cs}, void($\ast$process\_\-in)(void $\ast$, int32\_\-t), void $\ast$process\_\-in\_\-params)
\item 
void {\bf cs\_\-set\_\-process\_\-out} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t($\ast$process\_\-out)(void $\ast$), void $\ast$process\_\-out\_\-params)
\item 
int32\_\-t {\bf cs\_\-do\_\-process} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t consign)
\begin{CompactList}\small\item\em This function do the main loop of the control system process. \item\end{CompactList}\item 
void {\bf cs\_\-manage} (void $\ast$data)
\item 
int32\_\-t {\bf cs\_\-get\_\-out} (struct {\bf cs} $\ast${\bf cs})
\item 
int32\_\-t {\bf cs\_\-get\_\-error} (struct {\bf cs} $\ast${\bf cs})
\item 
int32\_\-t {\bf cs\_\-get\_\-consign} (struct {\bf cs} $\ast${\bf cs})
\item 
int32\_\-t {\bf cs\_\-get\_\-filtered\_\-consign} (struct {\bf cs} $\ast${\bf cs})
\item 
int32\_\-t {\bf cs\_\-get\_\-filtered\_\-feedback} (struct {\bf cs} $\ast${\bf cs})
\item 
void {\bf cs\_\-set\_\-consign} (struct {\bf cs} $\ast${\bf cs}, int32\_\-t v)
\end{CompactItemize}


\subsection{Define Documentation}
\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!DEBUG@{DEBUG}}
\index{DEBUG@{DEBUG}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[DEBUG]{\setlength{\rightskip}{0pt plus 5cm}\#define DEBUG~0}\label{control__system__manager_8c_d72dbcf6d0153db1b8d8a58001feed83}




Definition at line 24 of file control\_\-system\_\-manager.c.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!debug\_\-printf@{debug\_\-printf}}
\index{debug\_\-printf@{debug\_\-printf}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[debug\_\-printf]{\setlength{\rightskip}{0pt plus 5cm}\#define debug\_\-printf(args...)~do \{ \} while(0)}\label{control__system__manager_8c_acea5c89f299b0d2ae3db3be26d54114}




Definition at line 29 of file control\_\-system\_\-manager.c.

Referenced by calc\_\-rays(), complete(), cs\_\-do\_\-process(), intersect\_\-line(), intersect\_\-segment(), is\_\-crossing\_\-poly(), parse(), and parse\_\-num().

\subsection{Function Documentation}
\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-do\_\-process@{cs\_\-do\_\-process}}
\index{cs\_\-do\_\-process@{cs\_\-do\_\-process}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-do\_\-process]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-do\_\-process (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t {\em consign})}\label{control__system__manager_8c_17b614a36ac96988446aaf5d82706c98}


This function do the main loop of the control system process. 

\begin{itemize}
\item Save the consign in the structure.\item Apply the consign filter to the consign.\item Read the process out\item Apply the feedback filter to the process out\item Substract filtered consign to filtered process out.\item Save the result in error\_\-value and apply the correct filter.\item Save the filtered result and send it to process\_\-in().\item Return this result. \end{itemize}


Definition at line 183 of file control\_\-system\_\-manager.c.

References cs::consign\_\-filter, cs::consign\_\-filter\_\-params, cs::consign\_\-value, cs::correct\_\-filter, cs::correct\_\-filter\_\-params, debug\_\-printf, cs::error\_\-value, cs::feedback\_\-filter, cs::feedback\_\-filter\_\-params, cs::filtered\_\-consign\_\-value, cs::filtered\_\-feedback\_\-value, i, cs::out\_\-value, cs::process\_\-in, cs::process\_\-in\_\-params, cs::process\_\-out, and cs::process\_\-out\_\-params.

Referenced by cs\_\-manage().\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-get\_\-consign@{cs\_\-get\_\-consign}}
\index{cs\_\-get\_\-consign@{cs\_\-get\_\-consign}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-get\_\-consign]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-get\_\-consign (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_0301b88d00597b945091e5e33aaf5d7b}


Return the current consign 

Definition at line 264 of file control\_\-system\_\-manager.c.

References cs::consign\_\-value, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.

Referenced by trajectory\_\-finished().\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-get\_\-error@{cs\_\-get\_\-error}}
\index{cs\_\-get\_\-error@{cs\_\-get\_\-error}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-get\_\-error]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-get\_\-error (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_f0ce2fe1ea9690889df8ea528588d4e3}


Return the last calculated \doxyref{error}{p.}{structerror} 

Definition at line 251 of file control\_\-system\_\-manager.c.

References cs::error\_\-value, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-get\_\-filtered\_\-consign@{cs\_\-get\_\-filtered\_\-consign}}
\index{cs\_\-get\_\-filtered\_\-consign@{cs\_\-get\_\-filtered\_\-consign}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-get\_\-filtered\_\-consign]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-get\_\-filtered\_\-consign (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_c0cc72250c7fa80c9a4db2ef444145cf}


Return the current consign, after filter 

Definition at line 275 of file control\_\-system\_\-manager.c.

References cs::filtered\_\-consign\_\-value, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.

Referenced by trajectory\_\-finished().\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-get\_\-filtered\_\-feedback@{cs\_\-get\_\-filtered\_\-feedback}}
\index{cs\_\-get\_\-filtered\_\-feedback@{cs\_\-get\_\-filtered\_\-feedback}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-get\_\-filtered\_\-feedback]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-get\_\-filtered\_\-feedback (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_c8de3d1639afadf0e00025b5a908763c}


Return the last feedback value, after filter 

Definition at line 286 of file control\_\-system\_\-manager.c.

References cs::filtered\_\-feedback\_\-value, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-get\_\-out@{cs\_\-get\_\-out}}
\index{cs\_\-get\_\-out@{cs\_\-get\_\-out}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-get\_\-out]{\setlength{\rightskip}{0pt plus 5cm}int32\_\-t cs\_\-get\_\-out (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_d213700c9c797467094bf41f4a7bb217}


Return the last output sent to process 

Definition at line 238 of file control\_\-system\_\-manager.c.

References IRQ\_\-LOCK, IRQ\_\-UNLOCK, and cs::out\_\-value.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-init@{cs\_\-init}}
\index{cs\_\-init@{cs\_\-init}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-init (struct {\bf cs} $\ast$ {\em cs})}\label{control__system__manager_8c_e39f03a28b587ac44af8525b5d2902f4}


Initiate the control\_\-system structure by setting all fields to NULL 

Definition at line 102 of file control\_\-system\_\-manager.c.

References cs::consign\_\-filter, cs::consign\_\-filter\_\-params, cs::consign\_\-value, cs::correct\_\-filter, cs::correct\_\-filter\_\-params, cs::error\_\-value, cs::feedback\_\-filter, cs::feedback\_\-filter\_\-params, IRQ\_\-LOCK, IRQ\_\-UNLOCK, cs::out\_\-value, cs::process\_\-in, cs::process\_\-in\_\-params, cs::process\_\-out, and cs::process\_\-out\_\-params.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-manage@{cs\_\-manage}}
\index{cs\_\-manage@{cs\_\-manage}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-manage]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-manage (void $\ast$ {\em cs})}\label{control__system__manager_8c_f9ff6eb19c9d9112b6db4dda41e135a0}


Apply \doxyref{cs\_\-do\_\-process()}{p.}{control__system__manager_8c_17b614a36ac96988446aaf5d82706c98} to the structure \doxyref{cs}{p.}{structcs} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \doxyref{cs}{p.}{structcs}}]should be a (struct cs$\ast$) \end{description}
\end{Desc}


Definition at line 230 of file control\_\-system\_\-manager.c.

References cs::consign\_\-value, and cs\_\-do\_\-process().\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-consign@{cs\_\-set\_\-consign}}
\index{cs\_\-set\_\-consign@{cs\_\-set\_\-consign}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-consign]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-consign (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t {\em v})}\label{control__system__manager_8c_9eb7a9f4f8fd6896f46a92d2c29e7a2c}


Change the consign without calculating control system 

Definition at line 299 of file control\_\-system\_\-manager.c.

References cs::consign\_\-value, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.

Referenced by \_\-\_\-trajectory\_\-goto\_\-d\_\-a\_\-rel().\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-consign\_\-filter@{cs\_\-set\_\-consign\_\-filter}}
\index{cs\_\-set\_\-consign\_\-filter@{cs\_\-set\_\-consign\_\-filter}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-consign\_\-filter]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-consign\_\-filter (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t($\ast$)(void $\ast$, int32\_\-t) {\em consign\_\-filter}, \/  void $\ast$ {\em consign\_\-filter\_\-params})}\label{control__system__manager_8c_8fc5575d6e5db2096f23bb8636b22e04}


Set the \doxyref{cs}{p.}{structcs} consign\_\-filter fields in the \doxyref{cs}{p.}{structcs} structure 

Definition at line 130 of file control\_\-system\_\-manager.c.

References cs::consign\_\-filter, cs::consign\_\-filter\_\-params, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-correct\_\-filter@{cs\_\-set\_\-correct\_\-filter}}
\index{cs\_\-set\_\-correct\_\-filter@{cs\_\-set\_\-correct\_\-filter}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-correct\_\-filter]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-correct\_\-filter (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t($\ast$)(void $\ast$, int32\_\-t) {\em correct\_\-filter}, \/  void $\ast$ {\em correct\_\-filer\_\-params})}\label{control__system__manager_8c_ccaabddb167cc4776c1f14324a6e1aa7}


Set the \doxyref{cs}{p.}{structcs} correct\_\-filter fields in the \doxyref{cs}{p.}{structcs} structure 

Definition at line 141 of file control\_\-system\_\-manager.c.

References cs::correct\_\-filter, cs::correct\_\-filter\_\-params, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-feedback\_\-filter@{cs\_\-set\_\-feedback\_\-filter}}
\index{cs\_\-set\_\-feedback\_\-filter@{cs\_\-set\_\-feedback\_\-filter}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-feedback\_\-filter]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-feedback\_\-filter (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t($\ast$)(void $\ast$, int32\_\-t) {\em feedback\_\-filter}, \/  void $\ast$ {\em feedback\_\-filer\_\-params})}\label{control__system__manager_8c_7fa18ef002aab553b4daaaa96cb749cc}


Set the \doxyref{cs}{p.}{structcs} feedback\_\-filter fields in the \doxyref{cs}{p.}{structcs} structure 

Definition at line 151 of file control\_\-system\_\-manager.c.

References cs::feedback\_\-filter, cs::feedback\_\-filter\_\-params, IRQ\_\-LOCK, and IRQ\_\-UNLOCK.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-process\_\-in@{cs\_\-set\_\-process\_\-in}}
\index{cs\_\-set\_\-process\_\-in@{cs\_\-set\_\-process\_\-in}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-process\_\-in]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-process\_\-in (struct {\bf cs} $\ast$ {\em cs}, \/  void($\ast$)(void $\ast$, int32\_\-t) {\em process\_\-in}, \/  void $\ast$ {\em process\_\-in\_\-params})}\label{control__system__manager_8c_d2f1e962e2e8e4ddc3f0dfb46de907e4}


Set the \doxyref{cs}{p.}{structcs} process\_\-in fields in the \doxyref{cs}{p.}{structcs} structure 

Definition at line 161 of file control\_\-system\_\-manager.c.

References IRQ\_\-LOCK, IRQ\_\-UNLOCK, cs::process\_\-in, and cs::process\_\-in\_\-params.\index{control\_\-system\_\-manager.c@{control\_\-system\_\-manager.c}!cs\_\-set\_\-process\_\-out@{cs\_\-set\_\-process\_\-out}}
\index{cs\_\-set\_\-process\_\-out@{cs\_\-set\_\-process\_\-out}!control_system_manager.c@{control\_\-system\_\-manager.c}}
\subsubsection[cs\_\-set\_\-process\_\-out]{\setlength{\rightskip}{0pt plus 5cm}void cs\_\-set\_\-process\_\-out (struct {\bf cs} $\ast$ {\em cs}, \/  int32\_\-t($\ast$)(void $\ast$) {\em process\_\-out}, \/  void $\ast$ {\em process\_\-out\_\-params})}\label{control__system__manager_8c_65c3f1a523207ffc1a228d24c639499b}


Set the \doxyref{cs}{p.}{structcs} process\_\-out fields in the \doxyref{cs}{p.}{structcs} structure 

Definition at line 172 of file control\_\-system\_\-manager.c.

References IRQ\_\-LOCK, IRQ\_\-UNLOCK, cs::process\_\-out, and cs::process\_\-out\_\-params.