-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol specification.tex
141 lines (115 loc) · 4.37 KB
/
protocol specification.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
\documentclass[a4paper,12pt]{report}
\addtolength{\topmargin}{-1.1in}
\setlength\textheight{265mm}
\setlength\textwidth{165mm}
\setlength\oddsidemargin{-2mm}
\setlength\evensidemargin{-2mm}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage[a-2u]{pdfx}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{lmodern,textcomp}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}
\def\author{Havránek Kryštof <[email protected]>}
\def\name{UAV Project }
\makeatletter
\def\@makechapterhead#1{
{\parindent \z@ \raggedright \normalfont
\huge\bfseries #1
\par\nobreak
\vskip 20\p@
}}
\def\@makeschapterhead#1{
{\parindent \z@ \raggedright \normalfont
\huge\bfseries #1
\par\nobreak
\vskip 20\p@
}}
\makeatother
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{}}
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancyhead[L]{\textbf{\name -- \leftmark}}
\fancyfoot[L]{\author}
\fancyfoot[C]{}
\fancyfoot[R]{\thepage}
}
\begin{document}
\pagestyle{plain}
\chapter{Protocol specification}
\begin{itemize}
\item protocol desing
\begin{itemize}
\item 1st byte -- type of message
\item 2nd byte -- priority of message (for now for messages with higher priority than 0 new thread will be created)
\item 3rd and 4th byte -- gives information about size of message -- 3rd is 8 higher bytes, 4th is lower 8 bytes
\item 5 -- value to be added to check sum -- first 5 bytes need to be divisible by 7
\item ... -- message
\item each message is terminated with following sequence -- 0x00, 0x00, 0xFF, 0xFF, 0xFF
\end{itemize}
\item ranges
\begin{itemize}
\item 0x00 -- 0x20 -- settings management
\item 0x21 -- 0x40 -- control
\item 0x41 -- 0xFF -- telemetry
\end{itemize}
\item * symbol means code is only used as get request/confirmation
\item structures used are specified in \verb|<protocol_spec.h>|
\end{itemize}
\subsubsection{Settings}
\begin{center}
\begin{longtable}{| m{1cm} | m{1.5cm} | m{13cm} | }
\hline
0x01 & PI+CL & ping -- empty message send by both sides \\
0x02 & CL & restart of system \\
0x03 & CL & shutdown \\
0x04 & CL & disconnect client \\
0x08 & CL & camera settings \\
\hline
\end{longtable}
\end{center}
\subsubsection{Control}
\begin{itemize}
\item these messages are only send by the client to raspberry pi
\item standart control message will be send continuously -- every few milliseconds (client will have counter to prevent overloading of the server)
\item we are fine with few of these messages getting lost, as even minor movements will probably result in new message getting send
\item special message will send confirmation to the client
\begin{itemize}
\item client will add these messages to queue, which will be scanned from time to time
\item if response from server wasn't received in some time client will resend the message
\end{itemize}
\end{itemize}
\begin{center}
\begin{longtable}{| m{1cm} | m{1.5cm} | m{13cm} | }
\hline
0x21 & CL+PI* & standart control message -- status of analog joystick and shoulder buttons \\
0x22 & CL+PI* & special control event -- generated by pressing buttons that don't directly control control surfaces, but are free for further additions \\
\hline
\end{longtable}
\end{center}
\subsubsection{Telemetry}
\begin{itemize}
\item all telemetry, except pwm settings, is send in intervals
\item if client want new data immediately it can send message with same header
\item in such case using priority option is advisable
\item range above 0x80 is used for errors
\end{itemize}
\begin{center}
\begin{longtable}{| m{1cm} | m{1.5cm} | m{13cm} | }
\hline
0x41 & PI*+CL & status of all i/o \\
0x42 & PI*+CL & general packet including all information \\
0x43 & PI*+CL & attitude sensor and GPS \\
0x44 & PI*+CL & battery status (reading from ina226) \\
0x45 & PI*+CL & pwm setting on servo driver \\
0x81 & PI & general error message \\
\hline
\end{longtable}
\end{center}
\end{document}