<reponame>amirnn/Notes<filename>ROS/ROS.tex
\documentclass[]{report}
\usepackage{hyphenat}
\title{Notes on ROS}
\author{<NAME>}

\begin{document}
\maketitle

\section*{Preface}
The notes here are from the lecture Visual Navigation for Flying Robots by Dr. <NAME>. 
\chapter{Communication Paradigms}
    There are two Paradigms. These paradigms can be found in other robotic libraries as well.
    \begin{itemize}
        \item Message-based Communication. Asynchronous. In this one node (or a program) sends a message to the other.
        \item Direct (shared) memory access. Much more efficient but it can have side effects if not treated carefully.
    \end{itemize}
\section*{Forms of Communication}
    \begin{itemize}
        \item Push. One sends a Message
        \item Pull. One asks for data
        \item Publisher/Subscriber
        \item Remote procedure calls / service calls. Similar to a pull action but we send some parameters too. It can be synchronous.
        \begin{itemize}
            \item  preemptive tasks / taks. Async. Can take long time.
        \end{itemize}
        \subsection*{Push}
        One node sends data to the other. Publisher/Producer to Client. One way communcation. Sends the data as it is generated by the producer.
        \subsection*{pull}
        Data is delivered upon request by the consumer C (e.g. a 4k stream of video, a map of the building.)
        Useful if the consumer C controls the process and the data is not required (or availabe) at high frequency.

        C - Data request - P \\
        P - Data - C

        \subsection*{Publisher/Subscriber}
        One consumer C requests a subscription for the data by the producer P (e.g. a camera or GPS). The producer P sends the subscribed data as it is generated to C.
        Data generated accordignto a trigger (e.g., sensor data, computations, other messages, ...). This method helps in the thrift/frugality of data usage and computation power.
        We will recieve the data until we unsubscribe.
        C - subscription request - P \\
        P - data (t=0) - C \\
        P - data (t=1) - C \\
        \dots

        \subsection*{Publish to Blackboard (Shared memory)}
        The producer P sends data to the blackboard (e.g., parameter server)
        Consumer C pulls data from the Blackboard B; Only the last instance of data is stored int he Blackboard B.
        This is mostly used for storing parameters (State) at one centeral place.

        P - data - B - data request - C and C - data - B

        \subsection*{Service Calls}
        The client C sends a request to the server S. The server returns the result. The client waits for the result (synchronous communication)
        Also called: Remoter Procedure Call. This is a synchronous call but it can also get implmented as a asynchronous call.

        C - request + input data - S(server)
        S - result - C

        \section*{Actions (Preemptive Tasks)}


        \section*{ Concepts in ROS}
        \begin{itemize}
            \item Nodes: programs that communicate with eachother.
            \item Messages: data structres (e.g., "Image")
            \item Topics: typed message channels to which \\ nodes can publish/subscribe.  (e.g., /camera/image\_color)
            \item Parameters: Stored in a blackboard.
        \end{itemize}

        \section*{Software Management}
        \begin{itemize}
            \item Pacakge: atomic unit of building, contains one or more nodes and/or message definitions.
            \item Stack: atomic unit of releasing, contains several packages with a common theme.
            \item Repository: contains several stacks, typically one repository per institution.
        \end{itemize}
    \end{itemize}


\end{document}