\chapter{Technical equipment}

This thesis introduces a system consisting of a mobile robot equipped with precise global navigation satellite system (GNSS) receiver and a~radiation detection device. It can be controlled remotely through custom wireless interface.

\section{Robotic platform}\label{sec.orpheus}

Civil reconnaissance robot Orheus-X3 is used for experimenting. It was developed by Group of Robotics and AI at the Faculty of Electrical Engineering and Communication, Brno University of Technology. It is a four-wheeled mid-size robot equipped with sensory head carrying cameras. The head is unnecessary for radiation mapping, therefore it is not used. The robot has the ability to carry both the GNSS receiver with two antennas and gamma detectors with counting electronics. Basic parameters of the robot are shown in Tab. \ref{tab.orpheus}. A schematic picture of robot carrying key equipment is in Fig. \ref{fig.orpheus}. PC can be found inside robot’s body. All sensors are connected to this PC via Ethernet. The robot also provides power supply for sensors.

\begin{table}[ht]
\catcode`\-=12

\begin{center}
\caption{Parameters of the robot Orpheus-X3 \cite{ludek}}
\label{tab.orpheus}

\begin{tabular}{|l|l|}

\hline
{\bf Parameter} & {\bf Value} \\
\hline
Dimensions &  $950 \times 590 \times 415$ mm \\
\hline
Weight & 51 kg \\
\hline
Operation time & 120 min \\
\hline
Drive type & Differential \\
\hline
Maximal speed & 15 km$\cdot$h$^{-1}$ \\
\hline

\end{tabular}
\end{center}
\end{table}

\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=0.28]{images/orpheus.pdf}
  \end{center}
  \caption{Schematic picture of Orpheus-X3}
  \label{fig.orpheus}
\end{figure}


\section{GNSS receiver}
\label{sec.gnss}

For a precise measurement of position of the robot Orpheus-X3, two real time kinematic (RTK) GNSS receivers Trimble BX982 \cite{trimble} are used. One of them serves as stationary base station, the other one is located on the robot in rover configuration. The stationary module uses one antenna input and sends correction data to the rover module. The latter one has dual input for primary and vector antenna. That enables measurement of azimuth. An overview of basic receiver parameters is in Tab.~\ref{tab.gnss}. Whole GNSS configuration is shown in Fig.~\ref{fig.gnss}. 

\begin{table}[ht]
\catcode`\-=12

\begin{center}
\caption{Parameters of a GNSS receiver Trimble BX982 \cite{ludek}}
\label{tab.gnss}

\begin{tabular}{|l|l|}

\hline
{\bf Parameter} & {\bf Value} \\
\hline
Number of channels & 220 \\
\hline
GNSS supported & GPS, GLONASS \\
\hline
RTK & supported \\
\hline
Dual input for azimuth calculation & supported \\
\hline
Power & 9--28 V~DC, max 5 W \\
\hline
Weight & 1.6 kg \\
\hline
Dimensions & $264 \times 140 \times 55$ mm \\
\hline
Operating temperature & --40 °C to +70 °C \\
\hline

\end{tabular}
\end{center}
\end{table}

\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=0.32]{images/gnss}
  \end{center}
  \caption{GNSS configuration \cite{ludek}}
  \label{fig.gnss}
\end{figure}

\begin{table}[ht]
\catcode`\-=12

\begin{center}
\caption{Description of a GGA message \cite{gga}}
\label{tab.gga}

\begin{tabular}{|l|l|l|}

\hline
{\bf Field} & {\bf Example} & {\bf Meaning} \\
\hline
0 & GPGGA & Message identifier \\
\hline
1 & 172814.0 & UTC of position fix in {\it hhmmss.ss} format \\
\hline
2 & 3723.46587704 & Latitude in {\it ddmm.mmmm} format \\
\hline
3 & N & Direction of latitude -- N (North) or S (South) \\
\hline
4 & 12202.26957864 & Longitude in {\it ddmmm.mmmm} format \\
\hline
5 & W & Direction of longitude -- E (East) or W (West) \\
\hline
9 & 18.893 & Orthometric height (MSL reference) \\
\hline
10 & M & M -- unit of measure for orthometric height is meters \\
\hline
11 & -25.669 & Geoid separation \\
\hline
12 & M & M -- unit of measure for geoid separation is meters \\
\hline

\end{tabular}
\end{center}
\end{table}

Communication works in a mode where the PC serves as aserver and the receiver connects to it. IP address of the computer and port have to be configured prior to the measurement. UDP packets are used for transmission. Measurement frequency and data format can also be set. In PC it is only required to listen on the selected port and then receive data periodically.

Data are being sent in NMEA-0183 message format. These messages are prefaced with \texttt{\$} character and terminated by characters \texttt{\textbackslash r} and \texttt{\textbackslash n}. Values are separated by a comma. There is also a checksum at the end of the message, separated by \texttt{*} character. The checksum is the 8-bit XOR of all characters in the message, including the commas between fields, but not including the \texttt{\$} and \texttt{*} delimiters. The hexadecimal result is converted to two ASCII characters (0–9, A–F). For a proposed measurement system, GGA and PTNL-AVR messages are used. Message type is distinguished by an identifier. Example of GGA message \cite{gga}:\\
\texttt{\$GPGGA,172814.0,3723.46587704,N,12202.26957864,W,2,6,1.2,18.893,M,\\-25.669,M,2.0,0031*4F}

An overview of important values can be found in Tab.~\ref{tab.gga}. Example of PTNL- -AVR message \cite{avr}:\\
\texttt{\$PTNL,AVR,181059.6,+149.4688,Yaw,+0.0134,Tilt,,,60.191,3,2.5,6*00}

Important values are shown in Tab.~\ref{tab.avr}. Update rate of 10 Hz is sufficient for proposed application.



\begin{table}[ht]
\catcode`\-=12

\begin{center}
\caption{Description of a PTNL-AVR message \cite{avr}}
\label{tab.avr}

\begin{tabular}{|l|l|l|}

\hline
{\bf Field} & {\bf Example} & {\bf Meaning} \\
\hline
0, 1 & PTNL,AVR & Message identifier \\
\hline
2 & 181059.6 & UTC of vector fix in {\it hhmmss.ss} format \\
\hline
3 & +149.4688 & Yaw angle in degrees \\
\hline
5 & +0.0134 & Tilt angle in degrees \\
\hline

\end{tabular}
\end{center}
\end{table}

%\subsection{Transformation of coordinates}

Coordinates provided by the GNSS receiver correspond to the position of the main antenna in the front of the robot. In order to get coordinates of a radiation detector, transformation has to be performed. The situation is illustrated in Fig.~\ref{fig.transform}. Points $A_1, A_2$ represent the center of the main and vector GNSS antennas. Point $D$ represents center of detector. Angle $\alpha$ is an azimuth of a line connecting the antennas, $\phi$ is an angle between this line and an asix of the robot. Given these angles and coordinates of $A_1$\pnt{x_a,y_a}, coordinates of $D$\pnt{x_d,y_d} may be computed as:

\begin{subequations}
\begin{align}
x_d&= x_a + |A_1D|\cos{\beta} = y_a + |A_1D|\cos{(180^\circ+\phi-\alpha)} \\
y_d&= y_a + |A_1D|\sin{\beta} = y_a + |A_1D|\sin{(180^\circ+\phi-\alpha)}
\end{align}
\end{subequations}


\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=1.15]{images/transform.pdf}
  \end{center}
  \caption{Transformation of coordinates}
  \label{fig.transform}
\end{figure}

\section{Gamma radiation detection system}
\label{sec.detsys}

Detection system is composed of scintillation detectors and measuring electronics. A~pair of 2-inch NaI(Tl) detectors is used as scintillators. Detectors are integrated with photomultiplier tubes equipped with standard 14-pin base. Multichannel analyzers NuNA MCB3 \cite{mcb1} manufactured by company NUVIA a.s. are used as electronics. The analyzers provide high voltage source, a preamplifier, ADC sampling and processing. Data transfer is possible via USB or Ethernet. An overview of basic analyzer parameters is in Tab.~\ref{tab.mcb}. A detector together with an analyzer is denoted as {\it detector tube}.

Detector tubes are equipped with lead shielding. One half of each spherical detector is covered with 2 mm thick lead layer in direction to the other one. The reason is to intensify directional sensitivity of resulting detection system. 

\begin{table}[ht]
\catcode`\-=12

\begin{center}
\caption{Parameters of a multichannel analyzer NuNA MCB3 \cite{mcb2}}
\label{tab.mcb}

\begin{tabular}{|l|l|}

\hline
{\bf Parameter} & {\bf Value} \\
\hline
Dimensions & $60 \times 60 \times 112$ mm \\
\hline
Weight & 340 g\\
\hline
Power & 9 to 30 V DC, 4 W\\
\hline
Operating environment & $-$30 to 55 °C, max. 80\% humidity\\
\hline
Spectral resolution & 256, 512, 1024, 2048 or 4096 channels\\
\hline
Fine gain & 0.8 to 2.0\\
\hline
Dead time correction & Error <5 \% up to 50 000 CPS\\
\hline
High voltage source & 0 to 1100 V DC, step 1 V\\
\hline


\end{tabular}
\end{center}
\end{table}

Both the detector tubes are fixed to the robot by custom mounting. The mounting is composed of aluminum L profile and two sets of components printed on a 3D printer from polylactic acid (PLA). A model of complete mounting is in Fig.~\ref{fig.mounting}. Detector located closer to a center of the robot is denoted as {\it main detector}, the other one is {\it secondary detector}. The complete system consisting of robot, GNSS receiver and detector tubes is shown in Fig.~\ref{fig.orpheus}

\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=0.5]{images/mounting.pdf}
  \end{center}
  \caption{Mounting for detector tubes}
  \label{fig.mounting}
\end{figure}

\clearpage

\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=0.5]{images/robot}
  \end{center}
  \caption{Robot Orpheus-X3 carrying equipment for gamma radiation measurement}
  \label{fig.robot}
\end{figure}

Proprietary communication protocol is used for communication with analyzers \cite{mcb2}. No data are sent from the device without asking. Communication packet has the following structure: \\
\texttt{| NextB\_H | NextB\_M | NextB\_L | DevAdr | Cmd | Data | Checksum |} \\
where \texttt{NextB} (3 bytes) determines number of following bytes, \texttt{DevAdr} is reserved for communication via RS-485, \texttt{Cmd} is command code, and data are block of bytes. Checksum is two’s complement of 8-bit sum of all packet bytes. Device response has the same command code as request if there is no error. Code 0xE0 is returned if an error occurs. The following commands are important for measurement.

\subsubsection{cmLink – 0x01}

Serves for initiating a communication. PC does not send any data bytes, string containing brief description of device is returned.

\subsubsection{cmGetSpectrum – 0x03}

Serves for spectrum acquisition from the device. PC sends only commands without data. The device responds with a data block (all values have the most significant byte first):

\vspace{4pt}

\begin{tabular}{ll}
1. B & status of spectrum acquisition and compression \\
& bit 0--3 -- number of bytes per channel \\
& bit 7 -- spectrum acquisition is/is not in progress \\
2.--3. B & first channel defined by lower level discriminator (LLD) \\
4.--5. B & last channel defined by upper level discriminator (ULD) \\
6.--9. B & current Real time in 0.01 s \\
%\end{tabular}
%
%\begin{tabular}{ll}
10.--13. B & current Live time in 0.01 s \\
& (difference between Real and Live time represents dead time) \\
14.--15. B & conversion gain -- number of channels \\
16.--19. B & timestamp -- MCB3 does not have RTC; it sends 0xFFFFFFFF \\
20.--{\it n}. B & pulse values in each channel
\end{tabular}

\vspace{8pt}

The number of data bytes is determined by a number of channels in range LLD–ULD, and also by a compression level.

\subsubsection{cmStart – 0x05}

Serves for starting the spectrum acquisition. Device responds with one data byte:
\vspace{4pt}

\begin{tabular}{ll}
1 & spectrum acquisition started \\
0 & spectrum acquisition is already running
\end{tabular}

\subsubsection{cmStop – 0x06}

Serves for stopping the spectrum acquisition. Device responds with one data byte:
\vspace{4pt}

\begin{tabular}{ll}
1 & spectrum acquisition stopped \\
0 & spectrum acquisition is not running
\end{tabular}

\subsubsection{cmClr – 0x07}

Serves for clearing spectrum buffer. If successful, data byte with value 0x01 is returned.

\subsubsection{cmSetTimers – 0x08}

Serves for setting duration of spectrum acquisition. Resolution is 1 millisecond, values have the LSB first. If successful, data byte with value 0x01 is returned. PC sends the following data block:
\vspace{4pt}

\begin{tabular}{ll}
1.--4. B & requested Real time \\
5.--8. B & requested Live time
\end{tabular}

\subsubsection{cmSwitchHV – 0x0B}

Serves for switching on/off the high voltage source. PC sends one data byte with requested HV state. The device also responds with one data byte with actual HV state.
\vspace{4pt}

\begin{tabular}{ll}
1 & switch on HV source \\
0 & switch off HV source
\end{tabular}

\subsubsection{cmSetHV – 0x0C}

Serves for setting high voltage value. PC sends two data bytes with requested HV value (the LSB first). If successful, data byte with value 0x01 is returned.

\subsubsection{cmGetHV – 0x0D}

Serves for getting high voltage value. PC sends command only. The device responds with data block (values have the LSB first):
\vspace{4pt}

\begin{tabular}{ll}
1. B & 0 -- HV source switched off, 1 -- HV switched on \\
2.--3. B & set HV value \\
4.--5. B & actual HV value
\end{tabular}

\section{Navigation module}
\label{sec.navig}

Navigation module is a PC program responsible for a control of robot motion. It was developed by Ing. Tomáš Jílek, Ph.D. within his PhD thesis \cite{tom-phd}. One of its submodules is a self-localization module. It takes data from GNSS receivers, odometry and others in order to get precise position in selected coordinate system~– World Geodetic System 1984 (WGS-84) is used \cite{wgs}. To define a trajectory of the robot, a sequence of waypoints is used. The rotation center of the robot is navigated to current waypoint. When the waypoint is reached or detected as unreachable, the next waypoint is loaded. Ride along a rhumb line (loxodrome) is used for navigation.

The module can be controlled by commands sent through UDP protocol. The structure of commands comes out from NMEA messages:\\
\texttt{\$DVMSG,it1,it2,…,itn*CH[CR+LF]}\\
where \texttt{DV} is device code, \texttt{MSG} is message code, \texttt{it\#} are message items and \texttt{CH} is checksum. For basic control the following commands are used (delimiters, device code and checksum are omitted):
\vspace{4pt}

\begin{tabular}{ll}
1 & \texttt{LST,id,lat,latNS,lon,lonWE,lat\_err,lon\_err} \\
2 & \texttt{LST,END} \\
3 & \texttt{ACT,id} \\
4 & \texttt{CLR} \\
5 & \texttt{SES,state}
\end{tabular}

\vspace{8pt}

Command 1 allows setting of sequence of waypoints. Each message includes one waypoint defined by latitude and longitude (and their direction) along with ID which determines the order in the sequence. The second command follows the last item of sequence. Command 3 serves for setting which waypoint should be navigated to. Command 4 clears all waypoints. The last command sets the navigation state~– either \texttt{IDLE} or \texttt{GOFORWARD}. The following messages can be sent by a navigation module:
\vspace{4pt}

\begin{tabular}{ll}
1 & \texttt{WPT,id,lat,latNS,lon,lonWE,lat\_err,lon\_err} \\
2 & \texttt{GET,id}
\end{tabular}

\vspace{8pt}

The first one informs which waypoint is currently navigated to. The second serves for requesting lost or invalid waypoint. 

\section{Control software}

In order to manage data collection and control the robot’s trajectory (measurement trajectory), a software was developed using C\# language and .NET Framework. Several libraries were also developed to assist the main program. Their brief description now follows.

\subsection{Description}

{\it McbConnector} is responsible for communication with MCB modules. It implements a protocol described in Sec.~\ref{sec.detsys}. Communication is managed by two TCP clients, one of them is used for sending commands to the device and the other is asynchronously receiving any returned data. Those are then parsed and if valid, an event is invoked to inform the superior software components. Both sent and received messages are stored in a communication log.

{\it McbTimer} settles with periodic acquisition of spectrum data from all connected MCB modules. The time synchronization is provided by data from GNSS receiver, which include precise time information. Desired measurement period is 1 second, therefore spectrum data are requested if current time has integer seconds. Data are logged along with the corresponding position information. Also the library can be used for measurement when GNSS signal is not available (e. g. for calibration of detectors in laboratory), then the synchronization is provided by an internal timer.

{\it GnssConnector} is used for reception of position data from GNSS receiver. UDP client is set to listen on selected port and receives data asynchronously. For parsing the NMEA messages library {\it BX982NMEA} developed by Ing. Tomáš Jílek, Ph.D. is used. All received data are logged and also stored in buffer until it is extracted by a superior module. {\it GnssConnector} provides synchronization for {\it McbTimer}.

{\it NavConnector} is responsible for communication with the navigation module. It implements a protocol described in Sec.~\ref{sec.navig}. Communication is managed by a pair of UDP clients. When information about current waypoint is received, it is validated and passed to the superior module through an event.

{\it MapTransform} serves for transforming coordinates into different coordinate systems. It is important for planning the measurement trajectory, which is done in Cartesian system, while navigation module works in polar coordinates.

{\it RMath} provides mathematical background for other modules. It deals mostly with analytic geometry.

{\it MeasConfig} is responsible for configuration of the whole system. Configuration is parsed from an XML file and stored in defined structures where it is accessible to other modules.

{\it MeasMaster} is the most important and superior module. Among other things, it interconnects all previously introduced components. Before any experiment can take place, all components have to be set to the desired state and tested if they work correctly. During the experiment, this module is responsible for an eventual update of measurement trajectory. 

A flowchart of experiment control is shown in Fig.~\ref{fig.software}. First five steps fall into preparation. If any of them fails, the experiment is interrupted. The flowchart is then divided into two branches. The left one represents communication with the navigation module. Some waypoints are marked in a sense that measurement trajectory should be revised after they are reached. If there are no more waypoints left, the experiment is either completed or have failed, and control program can be stopped.

\begin{figure}[!h]
  \begin{center}
    \includegraphics[scale=0.42]{images/software.pdf}
  \end{center}
  \caption{Flowchart of the control software}
  \label{fig.software}
\end{figure}

The right branch represents acquisition of position and spectrum data. When current time has zero millisecond component, spectrum data are requested. Data are received asynchronously from two MCB modules which are distinguished by ID. The program has to wait until data from both modules are correctly received. Then the measurement trajectory may be revised. The control program is stopped after some stop condition is fulfilled.

\subsection{Configuration}

The whole system can be configured by XML file with defined nodes. The main node {\it radiation-config} contains at least seven inner nodes. Four of them serve for setting the gamma radiation detection system. Node {\it system-type} defines arrangement of a detection system, currently only {\it TwoDetector} system is supported. Pair of {\it detector-config} nodes store information about IP address, port, high voltage value and sensitivity for both the main and secondary detectors. Node {\it timer-config} contains measurement period and measurement time. The value of the first has to correspond with the update rate of GNSS receiver and is declared in milliseconds. The latter is set to inner timers of MCB modules and determines maximal spectrum acquisition time in seconds.

Another node, {\it gnss-config}, stores information for self-localization. Inner nodes define communication port and expected update rate. One of them also defines correction of measured yaw in degrees. If an axis of the robot and an axis of antennas form non-zero angle, the correction needs to be added to the measured value in order to get a value of yaw of the robot. In case of used arrangement, the correction value is $-30^{\circ}$.

Node {\it navigation-config} serves for setting communication with navigation module. It contains IP address and port, identification code of the system and allowed navigation error. The last mandatory node, {\it measurement-mode} defines type of control algorithm. Other nodes are dependent on the algorithm and will be described in the following chapter. An example of configuration file can be found in the Appendix~\ref{ap.config}.