\hypertarget{robot_8h}{}\section{robot.\+h File Reference} \label{robot_8h}\index{robot.\+h@{robot.\+h}} Fonctions for communicating with robot. {\ttfamily \#include $<$stdio.\+h$>$}\newline {\ttfamily \#include $<$unistd.\+h$>$}\newline {\ttfamily \#include $<$fcntl.\+h$>$}\newline {\ttfamily \#include $<$termios.\+h$>$}\newline {\ttfamily \#include $<$string.\+h$>$}\newline {\ttfamily \#include $<$stdlib.\+h$>$}\newline {\ttfamily \#include \char`\"{}definitions.\+h\char`\"{}}\newline Include dependency graph for robot.\+h\+:\nopagebreak \begin{figure}[H] \begin{center} \leavevmode \includegraphics[width=350pt]{robot_8h__incl} \end{center} \end{figure} \subsection*{Classes} \begin{DoxyCompactItemize} \item struct \hyperlink{struct_message_to_robot}{Message\+To\+Robot} \end{DoxyCompactItemize} \subsection*{Macros} \begin{DoxyCompactItemize} \item \#define \hyperlink{robot_8h_a32c8768c18732c59b503f8ee7515a693}{serial\+Port}~\char`\"{}/dev/tty\+S0\char`\"{} \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item int \hyperlink{robot_8h_a0e70fa821a04d349552b8bd54f6935db}{open\+\_\+communication\+\_\+robot} (const char $\ast$path=\hyperlink{robot_8h_a32c8768c18732c59b503f8ee7515a693}{serial\+Port}) \begin{DoxyCompactList}\small\item\em Ouvre la communication avec le robot. \end{DoxyCompactList}\item int \hyperlink{robot_8h_a3fbce7530a62f9287f8a3b85b9c7e4d7}{close\+\_\+communication\+\_\+robot} (void) \begin{DoxyCompactList}\small\item\em Ferme la communication avec le robot. \end{DoxyCompactList}\item int \hyperlink{robot_8h_abe88fd581be321a9d86ae7063abd2f65}{send\+\_\+command\+\_\+to\+\_\+robot} (char cmd, const char $\ast$arg=N\+U\+LL) \begin{DoxyCompactList}\small\item\em Envoi une commande au robot et attends sa réponse. \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection{Detailed Description} Fonctions for communicating with robot. \begin{DoxyAuthor}{Author} L.\+Senaneuch \end{DoxyAuthor} \begin{DoxyVersion}{Version} 1.\+0 \end{DoxyVersion} \begin{DoxyDate}{Date} 06/06/2017 \end{DoxyDate} \subsection{Macro Definition Documentation} \mbox{\Hypertarget{robot_8h_a32c8768c18732c59b503f8ee7515a693}\label{robot_8h_a32c8768c18732c59b503f8ee7515a693}} \index{robot.\+h@{robot.\+h}!serial\+Port@{serial\+Port}} \index{serial\+Port@{serial\+Port}!robot.\+h@{robot.\+h}} \subsubsection{\texorpdfstring{serial\+Port}{serialPort}} {\footnotesize\ttfamily \#define serial\+Port~\char`\"{}/dev/tty\+S0\char`\"{}} Definition at line 40 of file robot.\+h. \subsection{Function Documentation} \mbox{\Hypertarget{robot_8h_a3fbce7530a62f9287f8a3b85b9c7e4d7}\label{robot_8h_a3fbce7530a62f9287f8a3b85b9c7e4d7}} \index{robot.\+h@{robot.\+h}!close\+\_\+communication\+\_\+robot@{close\+\_\+communication\+\_\+robot}} \index{close\+\_\+communication\+\_\+robot@{close\+\_\+communication\+\_\+robot}!robot.\+h@{robot.\+h}} \subsubsection{\texorpdfstring{close\+\_\+communication\+\_\+robot()}{close\_communication\_robot()}} {\footnotesize\ttfamily int close\+\_\+communication\+\_\+robot (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})} Ferme la communication avec le robot. Ferme le descripteur de fichier du port serie contrôlant le robot. \begin{DoxyReturn}{Returns} Retourne -\/1 en cas d\textquotesingle{}erreur ou 0 en cas de fermeture effectué \end{DoxyReturn} \mbox{\Hypertarget{robot_8h_a0e70fa821a04d349552b8bd54f6935db}\label{robot_8h_a0e70fa821a04d349552b8bd54f6935db}} \index{robot.\+h@{robot.\+h}!open\+\_\+communication\+\_\+robot@{open\+\_\+communication\+\_\+robot}} \index{open\+\_\+communication\+\_\+robot@{open\+\_\+communication\+\_\+robot}!robot.\+h@{robot.\+h}} \subsubsection{\texorpdfstring{open\+\_\+communication\+\_\+robot()}{open\_communication\_robot()}} {\footnotesize\ttfamily int open\+\_\+communication\+\_\+robot (\begin{DoxyParamCaption}\item[{const char $\ast$}]{path = {\ttfamily \hyperlink{robot_8h_a32c8768c18732c59b503f8ee7515a693}{serial\+Port}} }\end{DoxyParamCaption})} Ouvre la communication avec le robot. Ouvre le serial port passé en paramétre. Par defaut cette fonction ouvre le port tty\+SO connecté au module xbee. \begin{DoxyParams}{Parameters} {\em path} & Chaine de caractère contenant le path du port serie à ouvrir. \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} Return -\/1 si l\textquotesingle{}ouverture c\textquotesingle{}est mal passé et 0 si le port est ouvert. \end{DoxyReturn} \mbox{\Hypertarget{robot_8h_abe88fd581be321a9d86ae7063abd2f65}\label{robot_8h_abe88fd581be321a9d86ae7063abd2f65}} \index{robot.\+h@{robot.\+h}!send\+\_\+command\+\_\+to\+\_\+robot@{send\+\_\+command\+\_\+to\+\_\+robot}} \index{send\+\_\+command\+\_\+to\+\_\+robot@{send\+\_\+command\+\_\+to\+\_\+robot}!robot.\+h@{robot.\+h}} \subsubsection{\texorpdfstring{send\+\_\+command\+\_\+to\+\_\+robot()}{send\_command\_to\_robot()}} {\footnotesize\ttfamily int send\+\_\+command\+\_\+to\+\_\+robot (\begin{DoxyParamCaption}\item[{char}]{cmd, }\item[{const char $\ast$}]{arg = {\ttfamily NULL} }\end{DoxyParamCaption})} Envoi une commande au robot et attends sa réponse. Envoi une commande au robot en ajoutant le checksum et lis la réponse du robot en verifiant le checksum. Le premier paramétre {\itshape cmd} correspond au type de commande ex \+: P\+I\+NG, S\+E\+T\+M\+O\+VE ... Le second paramétre {\itshape $\ast$arg} correspond aux arguments à la commande ex \+: S\+E\+T\+M\+O\+VE, \char`\"{}100\char`\"{} La fonction retourne un code confirmation transmise par le robot (R\+O\+B\+O\+T\+\_\+\+C\+H\+E\+K\+S\+UM, R\+O\+B\+O\+T\+\_\+\+E\+R\+R\+OR, R\+O\+B\+O\+T\+\_\+\+T\+I\+M\+E\+D\+\_\+\+O\+UT, R\+O\+B\+O\+T\+\_\+\+OK, R\+O\+B\+O\+T\+\_\+\+U\+K\+N\+O\+W\+\_\+\+C\+MD) \begin{DoxyParams}{Parameters} {\em cmd} & Entête de la commande \\ \hline {\em arg} & Argument de la commande \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} Retourne un code confirmation. \end{DoxyReturn}