<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Podhrmic</id>
	<title>PaparazziUAV - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.paparazziuav.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Podhrmic"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Podhrmic"/>
	<updated>2026-05-18T18:55:35Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24126</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24126"/>
		<updated>2018-11-24T23:13:17Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* setschedparam failed!&amp;quot; error */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
'''Update March 2018: HITL currently works only with Pprzlink 1.0, please recompile paparazzi with PPRZLINK_LIB_VERSION=1.0. We are working on a fix.'''&lt;br /&gt;
&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
HITL currently (Ubuntu 16.04) needs the following two steps to run correctly:&lt;br /&gt;
* set rtpriority for the uart threads [https://stackoverflow.com/questions/8111302/why-does-pthread-setschedparam-produce-eperm-on-opensuse-11-4 detailes here] by adding these two lines to your ''/etc/security/limits.conf'' file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
$USER       soft    rtprio   100&lt;br /&gt;
$USER       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where ''$USER'' is your username&lt;br /&gt;
&lt;br /&gt;
* install ''pyserial'' package (needed for SBUS Fakerator), typically with ''sudo install pyserial''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input (provides position and orientation data, including GPS coordinates)&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use your own session, you have to pass ''-t hitl'' flag into ''sw/simulator/pprzsim-launch'' to start in HITL mode. Have a look at the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_control_panel.xml#L126 HITL USB-serual@57600] session for example, or add this to your own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your control_panel.xml file&lt;br /&gt;
&amp;lt;session&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
     &amp;lt;program name=&amp;quot;Simulator&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-a&amp;quot; constant=&amp;quot;@AIRCRAFT&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-f&amp;quot; constant=&amp;quot;127.0.0.1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-b&amp;quot; constant=&amp;quot;127.255.255.255&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;--fg_fdm&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-t&amp;quot; constant=&amp;quot;hitl&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/program&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/session&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem that is not mentioned here, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
Known issues:&lt;br /&gt;
&lt;br /&gt;
=== setschedparam failed error ===&lt;br /&gt;
If you get &amp;quot;setschedparam failed!&amp;quot; error when running NPS/HITL, you have to change limits.conf - see https://stackoverflow.com/q/10704983/9237888&lt;br /&gt;
&lt;br /&gt;
In short, edit your ''/etc/security/limits.conf'' file and add these lines at the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
YOUR_USERNAME       soft    rtprio   100&lt;br /&gt;
YOUR_USERNAME       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then I believe you have to restart your computer in order for limits to refresh.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Minion_HITL.png|600px|center|Minion in the air]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24125</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24125"/>
		<updated>2018-11-24T23:12:38Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
'''Update March 2018: HITL currently works only with Pprzlink 1.0, please recompile paparazzi with PPRZLINK_LIB_VERSION=1.0. We are working on a fix.'''&lt;br /&gt;
&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
HITL currently (Ubuntu 16.04) needs the following two steps to run correctly:&lt;br /&gt;
* set rtpriority for the uart threads [https://stackoverflow.com/questions/8111302/why-does-pthread-setschedparam-produce-eperm-on-opensuse-11-4 detailes here] by adding these two lines to your ''/etc/security/limits.conf'' file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
$USER       soft    rtprio   100&lt;br /&gt;
$USER       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where ''$USER'' is your username&lt;br /&gt;
&lt;br /&gt;
* install ''pyserial'' package (needed for SBUS Fakerator), typically with ''sudo install pyserial''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input (provides position and orientation data, including GPS coordinates)&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use your own session, you have to pass ''-t hitl'' flag into ''sw/simulator/pprzsim-launch'' to start in HITL mode. Have a look at the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_control_panel.xml#L126 HITL USB-serual@57600] session for example, or add this to your own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your control_panel.xml file&lt;br /&gt;
&amp;lt;session&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
     &amp;lt;program name=&amp;quot;Simulator&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-a&amp;quot; constant=&amp;quot;@AIRCRAFT&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-f&amp;quot; constant=&amp;quot;127.0.0.1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-b&amp;quot; constant=&amp;quot;127.255.255.255&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;--fg_fdm&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-t&amp;quot; constant=&amp;quot;hitl&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/program&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/session&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem that is not mentioned here, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
Known issues:&lt;br /&gt;
&lt;br /&gt;
=== setschedparam failed!&amp;quot; error ===&lt;br /&gt;
If you get &amp;quot;setschedparam failed!&amp;quot; error when running NPS/HITL, you have to change limits.conf - see https://stackoverflow.com/q/10704983/9237888&lt;br /&gt;
&lt;br /&gt;
In short, edit your ''/etc/security/limits.conf'' file and add these lines at the bottom:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
YOUR_USERNAME       soft    rtprio   100&lt;br /&gt;
YOUR_USERNAME       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then I believe you have to restart your computer in order for limits to refresh.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Minion_HITL.png|600px|center|Minion in the air]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24031</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24031"/>
		<updated>2018-03-27T18:22:44Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzlink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be sent in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte. '''s-pprzlink''' works with any STM32-F4 and higher autopilot (it requires a random number generator on chip), and doesn't have any other hardware dependecies (such as FPU etc.).&lt;br /&gt;
&lt;br /&gt;
Encrypted communication should be used anytime there is a potential risk of an adversary listening and modyfing telemetry/datalink messages. While this risk is probably small for short hobby flights with very cheap drones, it might be non-negligible for a large remote sensing mission with expensive (tens of thousands of $) equipment. For sensitive missions, the RC commands should be run over datalink too (choose [[Airframe_Configuration#Radio_Control|RC_datalink]] as your RC module), to close the security gap for RC controlled drones.&lt;br /&gt;
&lt;br /&gt;
We hope that Paparazzi users will find '''s-pprzlink''' useful and convenient, and if you have any comments, suggestions or bug reports, please file [https://github.com/paparazzi/paparazzi/issues an issue on github].&lt;br /&gt;
[https://github.com/podhrmic podhrmic] would like to acknowledge [https://galois.com/ Galois] for contributed time and experize, [https://senman.cz Senman] for help with implementation and [http://aggieair.usu.edu/ AggieAir] for flight testing.&lt;br /&gt;
&lt;br /&gt;
== Encryption and Key exchange ==&lt;br /&gt;
Large parts of this text are from [https://github.com/GaloisInc/gec Galois Embedded Crypto], please consult there for more details.&lt;br /&gt;
&lt;br /&gt;
GEC key exchange is accomplished by combining the Station-To-Station (STS) protocol with curve25519 for key exchange, ed25519 for authentication, SHA512 with a counter for key derivation, and finally Chacha20Poly1305 for the key confirmation. Assume parties A and B with ed25519 asymmetric key pairs (Pa,Qa) and (Pb,Qb). The protocol proceeds as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#    A generates an ephemeral (random) curve25519 key pair (Pae, Qae) and sends Pae.&lt;br /&gt;
#    B generates ephemeral curve25519 key pair (Pbe, Qbe).&lt;br /&gt;
#    B computes the shared secret: z = scalar_multiplication(Qbe, Pae)&lt;br /&gt;
#    B uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    B computes the ed25519 signature: sig = signQb(Pbe || Pae)&lt;br /&gt;
#    B computes and sends the message Pbe || Ekey=Kb,IV=Sb||zero(sig)&lt;br /&gt;
#    A computes the shared secret: z = scalar_multiplication(Qae, Pbe)&lt;br /&gt;
#    A uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    A decrypts the remainder of the message, verifies the signature.&lt;br /&gt;
#    A computes the ed25519 signature: sig = signQa(Pae || Pbe)&lt;br /&gt;
#    A computes and sends the message Ekey=Ka,IV=Sa||zero(sig)&lt;br /&gt;
#    A returns the values (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
#    B decrypts the message and verifies the signature. B then returns the tuple (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The wire-format is unsurprisingly a reproduction of the messages in the above computations:&lt;br /&gt;
&lt;br /&gt;
    message1 = [ Pae (32 bytes) ]&lt;br /&gt;
    message2 = [ Pbe (32 bytes) | Encrypted Signature (64 bytes) ]&lt;br /&gt;
    message3 = [ Encrypted Signature (64 bytes) ]&lt;br /&gt;
&lt;br /&gt;
The key derivation function is a SHA512 hash of the concatenation of a 16 bit big endian counter, the shared secret 'z', and a one byte party-specific identifier (0 for A, 1 for B and 2 for key material returned to the callee). The requested sizes are all under the output size of SHA512 so the counter is always zero and the return values are the first N bytes of the hash depending on the amount requested.&lt;br /&gt;
&lt;br /&gt;
    kdf(z,partyIdent) = SHA512( 0 || z || partyIdent)&lt;br /&gt;
&lt;br /&gt;
N.B. This key derivation technique is a common one, appearing in NIST SP 800-56A and other standards.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
== How to use it == &lt;br /&gt;
&lt;br /&gt;
For start, we recommend using one of the existing configurations. You can then modify your own airfame as needed. Us ''aggieair_control_panel.xml'' as your control panel and ''aggieair_conf.xml'' as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|500px|frame|center|Aggieair conf]]&lt;br /&gt;
&lt;br /&gt;
Choose ''Atomic'' airframe. If you are using your own airframe, simply change your telemetry module to ''telemetry_gec'' with optional ''GEC_STATUS_LED'' indicator (if your autopilot has an extra LED):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &lt;br /&gt;
      &amp;lt;module name=&amp;quot;telemetry&amp;quot;   type=&amp;quot;transparent_gec&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_PORT&amp;quot;        value=&amp;quot;UART3&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_BAUD&amp;quot;        value=&amp;quot;B57600&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;define name=&amp;quot;GEC_STATUS_LED&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Build and upload your code. Secure link works for [[NPS|NP]] targets, as well as for regular AP targets. Currently STM32-F4 autopilots are supported (you need a random number generator on chip), in bare metal version (ChibiOS will come later).&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you are planning to use [[HITL]] and secure link for telemetry at the same time, '''do not''' clean before building the target, because then you would remove the generated keys, needed for the key exchange (as described below).&lt;br /&gt;
&lt;br /&gt;
Choose either '''Secure Simulation''' (for NPS target) or '''Secure USB-serial@57600''' for regular flight, or '''Secure HITL USB-serial@57600''' for HITL target. If it is your first time running secure datalink, [https://doc.rust-lang.org/cargo/guide/ cargo] will download and compile [https://github.com/paparazzi/rustlink rustlink] which takes care of the ground part of secure communication. Once it is built, the keys are exchanged and you should see something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg3.png|500px|frame|center|Rustlink initiating secure communication]]&lt;br /&gt;
&lt;br /&gt;
''Going OK'' means the secure connection was established. You should see your regular telemetry, and you can check the connection status in ''SECURE_LINK_STATUS'' message:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg2.png|700px|frame|center|HITL mission with secure link]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If either the UAV or rustlink resets, the secure connection is lost and has to be renegotiated. There is currently no mechanism for such, as allowing key renegotiation could introduce a security vulnerability.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
The 21 byte overhead at each message is the cost of secure communication. The exact effect on the message bandwidth depends on the length of messages being transmitted. The biggest difference is for short messages (such as ''PING'' or ''SETTING'') sent often. On the other hand, larger messages (such as ''ATTITUDE'' or ''GPS'') are proportionally less affected.&lt;br /&gt;
&lt;br /&gt;
For example, the following measurements were taken for nominal rotorcraft and fixedwing airframes:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|'''Type'''!!width=&amp;quot;10%&amp;quot;|'''Standard downlink'''!!width=&amp;quot;10%&amp;quot;|'''Secure downlink'''!!width=&amp;quot;10%&amp;quot;|'''Difference'''&lt;br /&gt;
|-&lt;br /&gt;
|nominal rotocraft||911 bytes/s||1450 bytes/s||1.59x&lt;br /&gt;
|-&lt;br /&gt;
|nominal fixedwing||678 bytes/s||1250 bytes/s||1.84x&lt;br /&gt;
|-&lt;br /&gt;
|fixedwing with sonar||1865 bytes/s||4500 bytes/s||2.4x&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For typical configuration the increase in transmitted data is from '''1.6''' to '''1.9''', so depending on the channel bandwith the frequency of some messages might have to be adjusted. In the extreme case (such as sending a short ''SONAR'' message at high frequency), secure link can increase the amount of transferred data more than 2.5 times.&lt;br /&gt;
&lt;br /&gt;
Chacha20 is a cipher that is fast in software, and is faster than software implementation of AES, but slower than a hardware implementation of AES. Nonetheless, the additional CPU from secure link is negligible (tested on [[Lisa/M v20|Lisa MX]]).&lt;br /&gt;
&lt;br /&gt;
== Message Format == &lt;br /&gt;
&lt;br /&gt;
Secure link is simply a wrapper around pprzlink message. The main difference is an additional ''CRYPTO BYTE'' which determines whether the message is encrypted (''CRYPTO BYTE=0xaa'') or not (''CRYPTO BYTE=0x55''). If the message is not encrypted, the rest of the message is identical to a standard pprzlink message (SOURCE_ID .. optional MSG Payload) as shown below.&lt;br /&gt;
&lt;br /&gt;
If the message is encrypted, we add 4 bytes of message counter (which is also used as IV for encryption/decryption), and 16 bytes of authentication tag (to authenticate the message before decryption).&lt;br /&gt;
The counter is transmitted in plaintext and is not authenticated, because if it is tampered with, the decryption will fail. Message routing information (SENDER ID and DESTINATION ID) are transmitted in plaintext so the message can be properly routed in multi-node network, but the data are authenticated - so any change is detected before decryption occurs (thus discarding the whole message). The message structure is shown below (note that Pprzlink 2.0 is the default version for Paparazzi).&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 1.0 ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V1 plain.png|500px|frame|center|Pprzlink 1.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V1 crypto.png|500px|frame|center|Pprzlink 1.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 2.0 ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|9|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|11..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V2 plain.png|500px|frame|center|Pprzlink 2.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V2 crypto.png|500px|frame|center|Pprzlink 2.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
== Whitelisting messages == &lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24030</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24030"/>
		<updated>2018-03-27T18:15:33Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be sent in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte. '''s-pprzlink''' works with any STM32-F4 and higher autopilot (it requires a random number generator on chip), and doesn't have any other hardware dependecies (such as FPU etc.).&lt;br /&gt;
&lt;br /&gt;
Encrypted communication should be used anytime there is a potential risk of an adversary listening and modyfing telemetry/datalink messages. While this risk is probably small for short hobby flights with very cheap drones, it might be non-negligible for a large remote sensing mission with expensive (tens of thousands of $) equipment. For sensitive missions, the RC commands should be run over datalink too (choose [[Airframe_Configuration#Radio_Control|RC_datalink]] as your RC module), to close the security gap for RC controlled drones.&lt;br /&gt;
&lt;br /&gt;
We hope that Paparazzi users will find '''s-pprzlink''' useful and convenient, and if you have any comments, suggestions or bug reports, please file [https://github.com/paparazzi/paparazzi/issues an issue on github].&lt;br /&gt;
[https://github.com/podhrmic podhrmic] would like to acknowledge [https://galois.com/ Galois] for contributed time and experize, [https://senman.cz Senman] for help with implementation and [http://aggieair.usu.edu/ AggieAir] for flight testing.&lt;br /&gt;
&lt;br /&gt;
== Encryption and Key exchange ==&lt;br /&gt;
Large parts of this text are from [https://github.com/GaloisInc/gec Galois Embedded Crypto], please consult there for more details.&lt;br /&gt;
&lt;br /&gt;
GEC key exchange is accomplished by combining the Station-To-Station (STS) protocol with curve25519 for key exchange, ed25519 for authentication, SHA512 with a counter for key derivation, and finally Chacha20Poly1305 for the key confirmation. Assume parties A and B with ed25519 asymmetric key pairs (Pa,Qa) and (Pb,Qb). The protocol proceeds as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#    A generates an ephemeral (random) curve25519 key pair (Pae, Qae) and sends Pae.&lt;br /&gt;
#    B generates ephemeral curve25519 key pair (Pbe, Qbe).&lt;br /&gt;
#    B computes the shared secret: z = scalar_multiplication(Qbe, Pae)&lt;br /&gt;
#    B uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    B computes the ed25519 signature: sig = signQb(Pbe || Pae)&lt;br /&gt;
#    B computes and sends the message Pbe || Ekey=Kb,IV=Sb||zero(sig)&lt;br /&gt;
#    A computes the shared secret: z = scalar_multiplication(Qae, Pbe)&lt;br /&gt;
#    A uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    A decrypts the remainder of the message, verifies the signature.&lt;br /&gt;
#    A computes the ed25519 signature: sig = signQa(Pae || Pbe)&lt;br /&gt;
#    A computes and sends the message Ekey=Ka,IV=Sa||zero(sig)&lt;br /&gt;
#    A returns the values (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
#    B decrypts the message and verifies the signature. B then returns the tuple (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The wire-format is unsurprisingly a reproduction of the messages in the above computations:&lt;br /&gt;
&lt;br /&gt;
    message1 = [ Pae (32 bytes) ]&lt;br /&gt;
    message2 = [ Pbe (32 bytes) | Encrypted Signature (64 bytes) ]&lt;br /&gt;
    message3 = [ Encrypted Signature (64 bytes) ]&lt;br /&gt;
&lt;br /&gt;
The key derivation function is a SHA512 hash of the concatenation of a 16 bit big endian counter, the shared secret 'z', and a one byte party-specific identifier (0 for A, 1 for B and 2 for key material returned to the callee). The requested sizes are all under the output size of SHA512 so the counter is always zero and the return values are the first N bytes of the hash depending on the amount requested.&lt;br /&gt;
&lt;br /&gt;
    kdf(z,partyIdent) = SHA512( 0 || z || partyIdent)&lt;br /&gt;
&lt;br /&gt;
N.B. This key derivation technique is a common one, appearing in NIST SP 800-56A and other standards.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
== How to use it == &lt;br /&gt;
&lt;br /&gt;
For start, we recommend using one of the existing configurations. You can then modify your own airfame as needed. Us ''aggieair_control_panel.xml'' as your control panel and ''aggieair_conf.xml'' as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|500px|frame|center|Aggieair conf]]&lt;br /&gt;
&lt;br /&gt;
Choose ''Atomic'' airframe. If you are using your own airframe, simply change your telemetry module to ''telemetry_gec'' with optional ''GEC_STATUS_LED'' indicator (if your autopilot has an extra LED):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &lt;br /&gt;
      &amp;lt;module name=&amp;quot;telemetry&amp;quot;   type=&amp;quot;transparent_gec&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_PORT&amp;quot;        value=&amp;quot;UART3&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_BAUD&amp;quot;        value=&amp;quot;B57600&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;define name=&amp;quot;GEC_STATUS_LED&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Build and upload your code. Secure link works for [[NPS|NP]] targets, as well as for regular AP targets. Currently STM32-F4 autopilots are supported (you need a random number generator on chip), in bare metal version (ChibiOS will come later).&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you are planning to use [[HITL]] and secure link for telemetry at the same time, '''do not''' clean before building the target, because then you would remove the generated keys, needed for the key exchange (as described below).&lt;br /&gt;
&lt;br /&gt;
Choose either '''Secure Simulation''' (for NPS target) or '''Secure USB-serial@57600''' for regular flight, or '''Secure HITL USB-serial@57600''' for HITL target. If it is your first time running secure datalink, [https://doc.rust-lang.org/cargo/guide/ cargo] will download and compile [https://github.com/paparazzi/rustlink rustlink] which takes care of the ground part of secure communication. Once it is built, the keys are exchanged and you should see something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg3.png|500px|frame|center|Rustlink initiating secure communication]]&lt;br /&gt;
&lt;br /&gt;
''Going OK'' means the secure connection was established. You should see your regular telemetry, and you can check the connection status in ''SECURE_LINK_STATUS'' message:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg2.png|700px|frame|center|HITL mission with secure link]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If either the UAV or rustlink resets, the secure connection is lost and has to be renegotiated. There is currently no mechanism for such, as allowing key renegotiation could introduce a security vulnerability.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
The 21 byte overhead at each message is the cost of secure communication. The exact effect on the message bandwidth depends on the length of messages being transmitted. The biggest difference is for short messages (such as ''PING'' or ''SETTING'') sent often. On the other hand, larger messages (such as ''ATTITUDE'' or ''GPS'') are proportionally less affected.&lt;br /&gt;
&lt;br /&gt;
For example, the following measurements were taken for nominal rotorcraft and fixedwing airframes:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|'''Type'''!!width=&amp;quot;10%&amp;quot;|'''Standard downlink'''!!width=&amp;quot;10%&amp;quot;|'''Secure downlink'''!!width=&amp;quot;10%&amp;quot;|'''Difference'''&lt;br /&gt;
|-&lt;br /&gt;
|nominal rotocraft||911 bytes/s||1450 bytes/s||1.59x&lt;br /&gt;
|-&lt;br /&gt;
|nominal fixedwing||678 bytes/s||1250 bytes/s||1.84x&lt;br /&gt;
|-&lt;br /&gt;
|fixedwing with sonar||1865 bytes/s||4500 bytes/s||2.4x&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For typical configuration the increase in transmitted data is from '''1.6''' to '''1.9''', so depending on the channel bandwith the frequency of some messages might have to be adjusted. In the extreme case (such as sending a short ''SONAR'' message at high frequency), secure link can increase the amount of transferred data more than 2.5 times.&lt;br /&gt;
&lt;br /&gt;
Chacha20 is a cipher that is fast in software, and is faster than software implementation of AES, but slower than a hardware implementation of AES. Nonetheless, the additional CPU from secure link is negligible (tested on [[Lisa/M v20|Lisa MX]]).&lt;br /&gt;
&lt;br /&gt;
== Message Format == &lt;br /&gt;
&lt;br /&gt;
Secure link is simply a wrapper around pprzlink message. The main difference is an additional ''CRYPTO BYTE'' which determines whether the message is encrypted (''CRYPTO BYTE=0xaa'') or not (''CRYPTO BYTE=0x55''). If the message is not encrypted, the rest of the message is identical to a standard pprzlink message (SOURCE_ID .. optional MSG Payload) as shown below.&lt;br /&gt;
&lt;br /&gt;
If the message is encrypted, we add 4 bytes of message counter (which is also used as IV for encryption/decryption), and 16 bytes of authentication tag (to authenticate the message before decryption).&lt;br /&gt;
The counter is transmitted in plaintext and is not authenticated, because if it is tampered with, the decryption will fail. Message routing information (SENDER ID and DESTINATION ID) are transmitted in plaintext so the message can be properly routed in multi-node network, but the data are authenticated - so any change is detected before decryption occurs (thus discarding the whole message). The message structure is shown below (note that Pprzlink 2.0 is the default version for Paparazzi).&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 1.0 ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V1 plain.png|500px|frame|center|Pprzlink 1.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V1 crypto.png|500px|frame|center|Pprzlink 1.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 2.0 ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|9|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|11..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V2 plain.png|500px|frame|center|Pprzlink 2.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V2 crypto.png|500px|frame|center|Pprzlink 2.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24028</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24028"/>
		<updated>2018-03-18T02:17:39Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzlink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be sent in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte. '''s-pprzlink''' works with any STM32-F4 and higher autopilot (it requires a random number generator on chip), and doesn't have any other hardware dependecies (such as FPU etc.).&lt;br /&gt;
&lt;br /&gt;
Encrypted communication should be used anytime there is a potential risk of an adversary listening and modyfing telemetry/datalink messages. While this risk is probably small for short hobby flights with very cheap drones, it might be non-negligible for a large remote sensing mission with expensive (tens of thousands of $) equipment. For sensitive missions, the RC commands should be run over datalink too (choose [[Airframe_Configuration#Radio_Control|RC_datalink]] as your RC module), to close the security gap for RC controlled drones.&lt;br /&gt;
&lt;br /&gt;
We hope that Paparazzi users will find '''s-pprzlink''' useful and convenient, and if you have any comments, suggestions or bug reports, please file [https://github.com/paparazzi/paparazzi/issues an issue on github].&lt;br /&gt;
[https://github.com/podhrmic podhrmic] would like to acknowledge [https://galois.com/ Galois] for contributed time and experize, [https://senman.cz Senman] for help with implementation and [http://aggieair.usu.edu/ AggieAir] for flight testing.&lt;br /&gt;
&lt;br /&gt;
== Encryption and Key exchange ==&lt;br /&gt;
Large parts of this text are from [https://github.com/GaloisInc/gec Galois Embedded Crypto], please consult there for more details.&lt;br /&gt;
&lt;br /&gt;
GEC key exchange is accomplished by combining the Station-To-Station (STS) protocol with curve25519 for key exchange, ed25519 for authentication, SHA512 with a counter for key derivation, and finally Chacha20Poly1305 for the key confirmation. Assume parties A and B with ed25519 asymmetric key pairs (Pa,Qa) and (Pb,Qb). The protocol proceeds as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#    A generates an ephemeral (random) curve25519 key pair (Pae, Qae) and sends Pae.&lt;br /&gt;
#    B generates ephemeral curve25519 key pair (Pbe, Qbe).&lt;br /&gt;
#    B computes the shared secret: z = scalar_multiplication(Qbe, Pae)&lt;br /&gt;
#    B uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    B computes the ed25519 signature: sig = signQb(Pbe || Pae)&lt;br /&gt;
#    B computes and sends the message Pbe || Ekey=Kb,IV=Sb||zero(sig)&lt;br /&gt;
#    A computes the shared secret: z = scalar_multiplication(Qae, Pbe)&lt;br /&gt;
#    A uses the key derivation function kdf(z,1) to compute Kb || Sb, kdf(z,0) to compute Ka || Sa, and kdf(z,2) to compute Kclient || Sclient.&lt;br /&gt;
#    A decrypts the remainder of the message, verifies the signature.&lt;br /&gt;
#    A computes the ed25519 signature: sig = signQa(Pae || Pbe)&lt;br /&gt;
#    A computes and sends the message Ekey=Ka,IV=Sa||zero(sig)&lt;br /&gt;
#    A returns the values (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
#    B decrypts the message and verifies the signature. B then returns the tuple (Kclient,Sclient) to the callee as the resulting key material.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The wire-format is unsurprisingly a reproduction of the messages in the above computations:&lt;br /&gt;
&lt;br /&gt;
    message1 = [ Pae (32 bytes) ]&lt;br /&gt;
    message2 = [ Pbe (32 bytes) | Encrypted Signature (64 bytes) ]&lt;br /&gt;
    message3 = [ Encrypted Signature (64 bytes) ]&lt;br /&gt;
&lt;br /&gt;
The key derivation function is a SHA512 hash of the concatenation of a 16 bit big endian counter, the shared secret 'z', and a one byte party-specific identifier (0 for A, 1 for B and 2 for key material returned to the callee). The requested sizes are all under the output size of SHA512 so the counter is always zero and the return values are the first N bytes of the hash depending on the amount requested.&lt;br /&gt;
&lt;br /&gt;
    kdf(z,partyIdent) = SHA512( 0 || z || partyIdent)&lt;br /&gt;
&lt;br /&gt;
N.B. This key derivation technique is a common one, appearing in NIST SP 800-56A and other standards.&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
== How to use it == &lt;br /&gt;
&lt;br /&gt;
For start, we recommend using one of the existing configurations. You can then modify your own airfame as needed. Us ''aggieair_control_panel.xml'' as your control panel and ''aggieair_conf.xml'' as shown below:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|500px|frame|center|Aggieair conf]]&lt;br /&gt;
&lt;br /&gt;
Choose ''Atomic'' airframe. If you are using your own airframe, simply change your telemetry module to ''telemetry_gec'' with optional ''GEC_STATUS_LED'' indicator (if your autopilot has an extra LED):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt; &lt;br /&gt;
      &amp;lt;module name=&amp;quot;telemetry&amp;quot;   type=&amp;quot;transparent_gec&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_PORT&amp;quot;        value=&amp;quot;UART3&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;configure name=&amp;quot;MODEM_BAUD&amp;quot;        value=&amp;quot;B57600&amp;quot;/&amp;gt;&lt;br /&gt;
        &amp;lt;define name=&amp;quot;GEC_STATUS_LED&amp;quot; value=&amp;quot;5&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Build and upload your code. Secure link works for [[NPS|NP]] targets, as well as for regular AP targets. Currently STM32-F4 autopilots are supported (you need a random number generator on chip), in bare metal version (ChibiOS will come later).&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If you are planning to use [[HITL]] and secure link for telemetry at the same time, '''do not''' clean before building the target, because then you would remove the generated keys, needed for the key exchange (as described below).&lt;br /&gt;
&lt;br /&gt;
Choose either '''Secure Simulation''' (for NPS target) or '''Secure USB-serial@57600''' for regular flight, or '''Secure HITL USB-serial@57600''' for HITL target. If it is your first time running secure datalink, [https://doc.rust-lang.org/cargo/guide/ cargo] will download and compile [https://github.com/paparazzi/rustlink rustlink] which takes care of the ground part of secure communication. Once it is built, the keys are exchanged and you should see something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg3.png|500px|frame|center|Rustlink initiating secure communication]]&lt;br /&gt;
&lt;br /&gt;
''Going OK'' means the secure connection was established. You should see your regular telemetry, and you can check the connection status in ''SECURE_LINK_STATUS'' message:&lt;br /&gt;
&lt;br /&gt;
[[File:CryptoMsg2.png|700px|frame|center|HITL mission with secure link]]&lt;br /&gt;
&lt;br /&gt;
'''NOTE:''' If either the UAV or rustlink resets, the secure connection is lost and has to be renegotiated. There is currently no mechanism for such, as allowing key renegotiation could introduce a security vulnerability.&lt;br /&gt;
&lt;br /&gt;
== Performance ==&lt;br /&gt;
&lt;br /&gt;
The 21 byte overhead at each message is the cost of secure communication. The exact effect on the message bandwidth depends on the length of messages being transmitted. The biggest difference is for short messages (such as ''PING'' or ''SETTING'') sent often. On the other hand, larger messages (such as ''ATTITUDE'' or ''GPS'') are proportionally less affected.&lt;br /&gt;
&lt;br /&gt;
For example, the following measurements were taken for nominal rotorcraft and fixedwing airframes:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|'''Type'''!!width=&amp;quot;10%&amp;quot;|'''Standard downlink'''!!width=&amp;quot;10%&amp;quot;|'''Secure downlink'''!!width=&amp;quot;10%&amp;quot;|'''Difference'''&lt;br /&gt;
|-&lt;br /&gt;
|nominal rotocraft||911 bytes/s||1450 bytes/s||1.59x&lt;br /&gt;
|-&lt;br /&gt;
|nominal fixedwing||678 bytes/s||1250 bytes/s||1.84x&lt;br /&gt;
|-&lt;br /&gt;
|fixedwing with sonar||1865 bytes/s||4500 bytes/s||2.4x&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For typical configuration the increase in transmitted data is from '''1.6''' to '''1.9''', so depending on the channel bandwith the frequency of some messages might have to be adjusted. In the extreme case (such as sending a short ''SONAR'' message at high frequency), secure link can increase the amount of transferred data more than 2.5 times.&lt;br /&gt;
&lt;br /&gt;
== Message Format == &lt;br /&gt;
&lt;br /&gt;
Secure link is simply a wrapper around pprzlink message. The main difference is an additional ''CRYPTO BYTE'' which determines whether the message is encrypted (''CRYPTO BYTE=0xaa'') or not (''CRYPTO BYTE=0x55''). If the message is not encrypted, the rest of the message is identical to a standard pprzlink message (SOURCE_ID .. optional MSG Payload) as shown below.&lt;br /&gt;
&lt;br /&gt;
If the message is encrypted, we add 4 bytes of message counter (which is also used as IV for encryption/decryption), and 16 bytes of authentication tag (to authenticate the message before decryption).&lt;br /&gt;
The counter is transmitted in plaintext and is not authenticated, because if it is tampered with, the decryption will fail. Message routing information (SENDER ID and DESTINATION ID) are transmitted in plaintext so the message can be properly routed in multi-node network, but the data are authenticated - so any change is detected before decryption occurs (thus discarding the whole message). The message structure is shown below (note that Pprzlink 2.0 is the default version for Paparazzi).&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 1.0 ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V1 plain.png|500px|frame|center|Pprzlink 1.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V1 crypto.png|500px|frame|center|Pprzlink 1.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== S-Pprzlink 2.0 ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|9|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|11..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V2 plain.png|500px|frame|center|Pprzlink 2.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V2 crypto.png|500px|frame|center|Pprzlink 2.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:CryptoMsg2.png&amp;diff=24027</id>
		<title>File:CryptoMsg2.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:CryptoMsg2.png&amp;diff=24027"/>
		<updated>2018-03-18T01:57:35Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:CryptoMsg3.png&amp;diff=24026</id>
		<title>File:CryptoMsg3.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:CryptoMsg3.png&amp;diff=24026"/>
		<updated>2018-03-18T01:55:45Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=24025</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=24025"/>
		<updated>2018-03-18T01:25:45Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24024</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24024"/>
		<updated>2018-03-18T01:24:48Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzlink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be sent in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
== Message Format == &lt;br /&gt;
&lt;br /&gt;
Secure link is simply a wrapper around pprzlink message. The main difference is an additional ''CRYPTO BYTE'' which determines whether the message is encrypted (''CRYPTO BYTE=0xaa'') or not (''CRYPTO BYTE=0x55''). If the message is not encrypted, the rest of the message is identical to a standard pprzlink message (SOURCE_ID .. optional MSG Payload) as shown below.&lt;br /&gt;
&lt;br /&gt;
If the message is encrypted, we add 4 bytes of message counter (which is also used as IV for encryption/decryption), and 16 bytes of authentication tag (to authenticate the message before decryption).&lt;br /&gt;
The counter is transmitted in plaintext and is not authenticated, because if it is tampered with, the decryption will fail. Message routing information (SENDER ID and DESTINATION ID) are transmitted in plaintext so the message can be properly routed in multi-node network, but the data are authenticated - so any change is detected before decryption occurs (thus discarding the whole message). The message structure is shown below (note that Pprzlink 2.0 is the default version for Paparazzi).&lt;br /&gt;
&lt;br /&gt;
=== Pprzlink 1.0 ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V1 plain.png|500px|frame|center|Pprzlink 1.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V1 crypto.png|500px|frame|center|Pprzlink 1.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Pprzlink 2.0 ===&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| crypto byte ||style=&amp;quot;background:red; color:white&amp;quot;|Crypto byte&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:purple; color:white&amp;quot;|Counter&lt;br /&gt;
|-&lt;br /&gt;
|7|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|9|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|11..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:V2 plain.png|500px|frame|center|Pprzlink 2.0 plaintext message]]&lt;br /&gt;
&lt;br /&gt;
[[File:V2 crypto.png|500px|frame|center|Pprzlink 2.0 encrypted message]]&lt;br /&gt;
&lt;br /&gt;
== Encryption and Key exchange ==&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:V2_crypto.png&amp;diff=24023</id>
		<title>File:V2 crypto.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:V2_crypto.png&amp;diff=24023"/>
		<updated>2018-03-18T01:14:18Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:V1_crypto.png&amp;diff=24022</id>
		<title>File:V1 crypto.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:V1_crypto.png&amp;diff=24022"/>
		<updated>2018-03-18T01:13:31Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:V2_plain.png&amp;diff=24021</id>
		<title>File:V2 plain.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:V2_plain.png&amp;diff=24021"/>
		<updated>2018-03-18T01:11:13Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:V1_plain.png&amp;diff=24020</id>
		<title>File:V1 plain.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:V1_plain.png&amp;diff=24020"/>
		<updated>2018-03-18T01:09:40Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24019</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24019"/>
		<updated>2018-03-18T00:50:11Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzlink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be sent in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24018</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24018"/>
		<updated>2018-03-18T00:48:43Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Language supports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/C C language]&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/ocaml Ocaml]&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink/tree/master/lib/v1.0/python Python]&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* [https://github.com/paparazzi/pprzlink-rust Rust]&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24017</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24017"/>
		<updated>2018-03-15T00:41:41Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* Rust&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzlink =&lt;br /&gt;
Secure Paparazzi link uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm for the symmetric key exchange.&lt;br /&gt;
&lt;br /&gt;
The overhead for encrypted communication is 21 bytes (1 byte signaling crypto/plaintext message, 4 bytes of the counter, 16 bytes of the authentication tag), for plaintext messages (such as key-exchange and some info messages) is only one byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24016</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24016"/>
		<updated>2018-03-15T00:34:36Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Ppprzink */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* Rust&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzink =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs]. The rest is handled by the paparazzi build system.&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24015</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24015"/>
		<updated>2018-03-15T00:33:47Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Language supports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* Rust&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure pprzlink (see below)&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzink =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs].&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mitls/hacl-star HACL*] also has to be installed. Paparazzi provides a convenient [https://github.com/paparazzi/hacl-c snapshot] of the generated C code. To install HACL*, go to ''sw/ext/hacl-c'' and type:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
sudo cp libhacl.* /usr/local/lib/.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24014</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=24014"/>
		<updated>2018-03-15T00:33:15Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Language supports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
* Rust&lt;br /&gt;
** similar to Python implementation, plus added memory safety&lt;br /&gt;
** used mainly for secure link&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzink =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs].&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mitls/hacl-star HACL*] also has to be installed. Paparazzi provides a convenient [https://github.com/paparazzi/hacl-c snapshot] of the generated C code. To install HACL*, go to ''sw/ext/hacl-c'' and type:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
sudo cp libhacl.* /usr/local/lib/.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Pprzlink proxy =&lt;br /&gt;
&lt;br /&gt;
When using several UAVs using UDP communication (or [[NPS]] simulations), the functionalities provided by the ''server'' agent is enough as long as there is no direct (air-to-air) communications (using v2 protocol). Otherwise, each UAV have to be accessed based on it's IP address or a specific port when simulating several aircraft on the same computer.&lt;br /&gt;
The connections between the ground and airborne agents then have to be done through the ''Pprzlink_proxy'' tool by associating the aircraft IDs with output and input ports (and eventually an IP address if different from the default value).&lt;br /&gt;
&lt;br /&gt;
Here is a list of usage examples:&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:4256:4247 --addr=192.168.1.1&lt;br /&gt;
 ./pprzlink_proxy.py --ac=101:4244:4245 --ac=102:192.168.1.2:4256:4247 --gcs=192.168.1.2&lt;br /&gt;
 ./pprzlink_proxy.py --script=proxy.txt&lt;br /&gt;
where 'proxy.txt' contains a list of parameters with the same format than the command line options (possibly one per line) and&lt;br /&gt;
 ./pprzlink_proxy.py -h&lt;br /&gt;
will show the complete list of options.&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Modems&amp;diff=24013</id>
		<title>Modems</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Modems&amp;diff=24013"/>
		<updated>2018-03-15T00:17:28Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Paparazzi autopilots generally feature a TTL serial port to interface with any common radio modem.  The bidirectional link provides real-time telemetry and in-flight tuning and navigation commands.  The system is also capable overlaying the appropriate protocols to communicate through non-transparent devices such as the Coronis Wavecard or Maxstream API-enabled products, allowing for hardware addressing for multiple aircraft or future enhancements such as data-relaying, inter-aircraft communication, RSSI signal monitoring and automatic in-flight modem power adjustment.  Below is a list of some of the common modems used with Paparazzi, for details on configuring your modem see the [[Airframe_Configuration#Telemetry_.28Modem.29|Airframe Configuration]] and [[XBee_configuration|XBee Configuration]] pages.&lt;br /&gt;
&lt;br /&gt;
==General comparison==&lt;br /&gt;
'''This is ONLY a comparison between modules on this page'''&lt;br /&gt;
&lt;br /&gt;
All modules listed here work without issue and are generally available.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; &lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''Feature'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_DigiMesh_.2F_802.15.4_.28.22Series_1.22.29|XBee Series 1]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_DigiMesh_.2F_802.15.4_.28.22Series_1.22.29|XBee Pro Series 1]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_ZB_.2F_ZNet_2.5_.28.22Series_2.22.29|XBee Series 2]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_ZB_.2F_ZNet_2.5_.28.22Series_2.22.29|XBee Pro Series 2]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_868LP|XBee 868LP]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_900HP|XBee Pro 900HP]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_XBee_Pro_XSC_900MHz|XBee Pro XSC 900]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Digi_9XTend|Digi 9XTend]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#SiLabs_Si1000_SoC_based_modems|SiLabs Si1000]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#AC4790-200|Aerocom AC4790-200]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#AC4790-1000|Aerocom AC4790-1000]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Laird_RM024|Laird RM024 50mW]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#Laird_RM024|Laird RM024 125mW]]'''&lt;br /&gt;
| align=&amp;quot;center&amp;quot;  style=&amp;quot;background:#f0f0f0;&amp;quot;|'''[[Modems#RN-41_Bluetooth_module.28Sparkfun.27s_WRL-08497.29|RN-41 Bluetooth]]'''&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''frequency'''||2,4GHz||2,4GHz||2,4GHz||2,4GHz||868MHz||900MHz||900MHz||900MHz, 2.4GHz||240-960MHz||900MHz||900MHz||2,4GHz||2,4GHz||2,4GHz&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''output power'''||1mW||63mW (US) 10 mW (Int'l)||2mW||63mW||5mW||250mW||250mW||1mW-1W||max 100mW||5-200mW||5-1000mW||2,5-50mW||2,5-125mW||32mW&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''RF speed'''||250kbps||250kbps||250kbps||250kbps||10kbps, 80kbps||10 or 200kbps||10, 20kbps||9.6, 115.2kbps|| ||76.8kbps||76.8kbps||280, 500kbps||280, 500kbps||300kbps&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''antenna'''||chip, wire, rpsma, u.fl||chip, wire, rpsma, u.fl||chip, wire, rpsma, u.fl||chip, wire, rpsma, u.fl||external required||wire, rpsma, u.fl||wire, rpsma, u.fl||rpsma, MMCX||external required||MMCX, internal Antenna||MMCX||u.fl, chip, both||u.fl, chip, both||pcb trace&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''pinout'''||XBee||XBee||XBee||XBee||SMD||XBee||XBee||20 pin 2,54mm/USB||SMD (42 pin LGA)||20 pin mini connector||20 pin mini connector||XBee/SMD||XBee/SMD||SMD&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''price'''||16€||26€||14€||28€||18€||32€||32€||150€||4€||52€||64€||30€||30€||20€&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;background:#f0f0f0;&amp;quot;|'''for Country'''||Worldwide||Worldwide||Worldwide||Worldwide||Europe||North America, Australia||North America, Australia||Worldwide||Worldwide||North America, Australia||North America, Australia||Europe||North America||Worldwide&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Frequencies ==&lt;br /&gt;
&lt;br /&gt;
Analog and digital signals (video and data/modem) can not be transmitted over the same frequency band since the analog signal will &amp;quot;block&amp;quot; the digital one. (Attention ! the common 2.4 or 5.8GHz frequencies have multiple channels, if the analog and digital transmitter/receiver modules are set up to different channels/frequencies, they should work (even on 2.4GHz)).&lt;br /&gt;
&lt;br /&gt;
You may want to inform yourself about your countries laws ! Different countries allow different frequencies at different power. &amp;lt;br/&amp;gt;&lt;br /&gt;
Sending on a wrong frequency or with too much power may end in a serious lawsuit !&lt;br /&gt;
&lt;br /&gt;
Digi: [http://www.digi.com/technology/rfmodems/agencyapprovals Government Agency Certifications]&lt;br /&gt;
&lt;br /&gt;
== HAM / CEPT Licence ==&lt;br /&gt;
&lt;br /&gt;
If possible, consider making a HAM radio (amateur radio) licence. (e.g. CEPT, depends on your locality)&lt;br /&gt;
&lt;br /&gt;
You will learn about the radio technology, operational technology and legislation.&amp;lt;br/&amp;gt;&lt;br /&gt;
With a HAM radio licence, you can also use other frequencies or transmit on a higher power. (e.g. In some countries, the 5.8GHz video transmission is for non licenced people restricted to 10mW!)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Licence Pros'''&lt;br /&gt;
* You will be informed well about the (local and international) legislations.&lt;br /&gt;
* You can transmit on a higher power (depends on frequency).&lt;br /&gt;
* You will learn a lot about the techniques and be more than a standard &amp;quot;consumer&amp;quot; of radio electronic products.&lt;br /&gt;
* It will be easier to find faults in your radio systems.&lt;br /&gt;
* You can build (if you want) high gain/focused antennas which can give you a better signal, wider range and won't disturb anyone else. &lt;br /&gt;
* Well educated people respecting the legislation just looks much better in looks to UAV's :)&lt;br /&gt;
&lt;br /&gt;
'''Licence Cons'''&lt;br /&gt;
* You will need to learn for the test (can be compared with a diverce licence).&lt;br /&gt;
* The certificate and books will cost about 70€ (total, can vary !).&lt;br /&gt;
* Maybe some costs (per year) for your call sign.&lt;br /&gt;
&lt;br /&gt;
=== CEPT Licence in Austria ===&lt;br /&gt;
&lt;br /&gt;
A short description about getting the CEPT 1 (not the CEPT Novice !) licence in Austria.&lt;br /&gt;
&lt;br /&gt;
You will need the appropriate books which cost 50€ (70€ if you want them with the ask catalog and answers which can be helpful) and rough 18€ for the exam and certificate. The ÖVSV offers also some courses, but you can also learn everything with the books.&lt;br /&gt;
&lt;br /&gt;
The are (regularly?) HAM licence courses at the https://metalab.at/ in Vienna.&lt;br /&gt;
&lt;br /&gt;
To be continued...&lt;br /&gt;
&lt;br /&gt;
=== Links ===&lt;br /&gt;
&lt;br /&gt;
[http://www.oevsv.at/ Austrian ÖVSV]&amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.darc.de/ German DARC]&lt;br /&gt;
&lt;br /&gt;
== Digi XBee modules ==&lt;br /&gt;
&lt;br /&gt;
Digi (formerly Maxstream) offers an increasing variety of Zigbee protocol modems well suited for Paparazzi in 2.4 GHz, 900MHz and 868Mhz frequencies.  The &amp;quot;Pro&amp;quot; series are long range, up to 40km!  Standard series are slightly smaller/lighter/lower power consumption and very short range.  All versions are all pin compatible and weigh around 2 grams with wire antennas. All Digi modems can be operated in transparent mode (as a serial line replacement) or in &amp;quot;API mode&amp;quot; with hardware addressing, managed networking, and RSSI (signal strength) data with the Paparazzi &amp;quot;Xbee&amp;quot; option.  &lt;br /&gt;
&lt;br /&gt;
Four antenna options are offered: RP-SMA, U-FL, wire antenna, chip antenna&lt;br /&gt;
&lt;br /&gt;
* XBee (PRO) ZB (the current series)&lt;br /&gt;
* XBee (PRO) ZNet 2.5 (formerly Series 2) (only legacy -&amp;gt; use XBee-PRO ZB)&lt;br /&gt;
The XBee &amp;amp; XBee-PRO ZB share hardware (ember stack) with XBee &amp;amp; XBee-PRO ZNet 2.5. As a result, modules can be &amp;quot;converted&amp;quot; from one platform to another by loading different firmware onto a given module.&lt;br /&gt;
&lt;br /&gt;
These two also share the same hardware and can be converted from one to another by flashing a different firmware:&lt;br /&gt;
* XBee-PRO 802.15.4 (formerly Series 1)&lt;br /&gt;
* XBee-PRO DigiMesh 2.4&lt;br /&gt;
&lt;br /&gt;
'''Note: Modules based on Freescale chipset (formerly Series 1) are not compatible with Ember chipset based modules (Series 2).'''&lt;br /&gt;
&lt;br /&gt;
If only point to point or point to multipoint communication is required 802.15.4 will do the job. These are designed for high data rates and low latency.&amp;lt;br/&amp;gt;&lt;br /&gt;
Modules with Zigbee firmware are needed for mesh functionality(communication between the UAV's)&lt;br /&gt;
&lt;br /&gt;
See the [[XBee_configuration|XBee Configuration]] page. This [http://pixhawk.ethz.ch/tutorials/how_to_configure_xbee tutorial] is also good to configure and get started with XBee Pro.&lt;br /&gt;
&lt;br /&gt;
=== Module Comparison ===&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''Module'''||'''Point-to-Multipoint'''||'''ZigBee/Mesh'''||'''Chipset'''|||'''Software stack'''||'''Frequency'''||'''TX Power normal/PRO'''||'''Notes'''&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee ZB'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Ember&lt;br /&gt;
|EmberZNet PRO 3.1 (ZigBee 2007)&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|2mW/50mW&lt;br /&gt;
|coordinator needed&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee ZNet 2.5'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Ember&lt;br /&gt;
|EmberZNet 2.5 ZigBee&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|2mW/50mW&lt;br /&gt;
|(only legacy -&amp;gt; use XBee-PRO ZB) coordinator needed&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee DigiMesh 2.4'''&lt;br /&gt;
|&lt;br /&gt;
|yes&lt;br /&gt;
|Freescale&lt;br /&gt;
|&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|&lt;br /&gt;
|all nodes equal (no special coordinators/routers/end-devices)&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee 802.15.4'''&lt;br /&gt;
|yes&lt;br /&gt;
|&lt;br /&gt;
|Freescale&lt;br /&gt;
|&lt;br /&gt;
|2.4 GHz&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|'''XBee-PRO 868'''&lt;br /&gt;
|yes&lt;br /&gt;
|&lt;br /&gt;
|?&lt;br /&gt;
|&lt;br /&gt;
|868 MHz&lt;br /&gt;
|500mW&lt;br /&gt;
|Only High Power Frequency allowed in the UK. 2.4GHz limited to 10mW&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Pinout ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Maxstream_Xbee_pinout.jpg|left|thumb|Maxstream XBee pinout]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||''Xbee 20-pin Header''||''Name''||''Notes''||''Suggested Color''||&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| +3.3v&lt;br /&gt;
| Power&lt;br /&gt;
|Red&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|DOUT&lt;br /&gt;
|Tx output - connect to Autopilot Rx&lt;br /&gt;
|Green&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|DIN&lt;br /&gt;
|Rx input - connect to Autopilot Tx&lt;br /&gt;
|Blue&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|GND&lt;br /&gt;
| Ground&lt;br /&gt;
|Black&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The image view is from above, top, thus NOT at the side where the connector pins come out&lt;br /&gt;
&lt;br /&gt;
Note : DTR and RTS need to be wired for upgrading firmware&lt;br /&gt;
&lt;br /&gt;
=== GCS Adaptation ===&lt;br /&gt;
&lt;br /&gt;
There are several vendors of hardware to connect the ground XBee radio modem to the GCS computer.&amp;lt;br/&amp;gt;&lt;br /&gt;
More information about general USB-Serial adapters can be found on the [[Serial_Adapter]] page.&lt;br /&gt;
&lt;br /&gt;
====Adafruit====&lt;br /&gt;
&lt;br /&gt;
[[Image:xbeeadapter_LRG.jpg|thumb|left|Adafruit XBee adapter board]][[Image:xbeeadapterftdi_LRG.jpg|thumb|Adafruit XBee adapter with FTDI cable]]&lt;br /&gt;
[http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=29&amp;amp;products_id=126 Adafruit] offers a great adapter board kit for the Xbee modules that includes a 5-3.3V voltage regulator, power and activity LEDs, and pins to connect directly to your FTDI cable for $10!  Some assembly required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Droids====&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_Simple_Board.jpg|thumb|left|XBee Simple Board]]&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_USB_Board.jpg|thumb|left|XBee USB Board]]&lt;br /&gt;
&lt;br /&gt;
[http://www.droids.it/cmsvb4/content.php?143-990.001-XBee-Simple-Board XBee Simple Board]&lt;br /&gt;
&lt;br /&gt;
Simple breakout board with voltage regulator.&lt;br /&gt;
&lt;br /&gt;
[http://www.droids.it/cmsvb4/content.php?152-990.002-XBee-USB-Board XBee USB Board]&lt;br /&gt;
&lt;br /&gt;
Adapter with FTDI chip for direct USB connection.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====PPZUAV====&lt;br /&gt;
&lt;br /&gt;
[[Image:FTDI_Utility_Board.jpg|thumb|left|FTDI Utility Board 1.0‎]]&lt;br /&gt;
&lt;br /&gt;
[https://www.ppzuav.com/osc/product_info.php?products_id=111 ppzuav.com product link]&amp;lt;br/&amp;gt;&lt;br /&gt;
More information at the [[Serial_Adapter#FTDI_utility_Board]] page.&lt;br /&gt;
&lt;br /&gt;
FTDI Utility Board 1.0  with FTDI232RL&amp;lt;br/&amp;gt;&lt;br /&gt;
On board XBEE connector and Molex Picoblade connectors. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Sparkfun====&lt;br /&gt;
&lt;br /&gt;
[[Image:XBee_Explorer_USB.jpg|thumb|left|XBee Explorer USB]]&lt;br /&gt;
&lt;br /&gt;
[http://www.sparkfun.com/products/8687 sparkfun.com]&lt;br /&gt;
&lt;br /&gt;
XBee Explorer USB with FTDI232RL&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro DigiMesh / 802.15.4 (&amp;quot;Series 1&amp;quot;) ===&lt;br /&gt;
*Note: Products based on XBee ZNet 2.5 (formerly Series 2) modules do not communicate with products based on XBee DigiMesh / 802.15.4 (formerly Series 1) modules.&lt;br /&gt;
&lt;br /&gt;
These relatively cheap and light modules implement the [http://www.zigbee.org/en/index.asp ZigBee/IEEE 802.15.4] norm. They allow up to 1.6km (1 mile) range (Paparazzi tested to 2.5km (1.5 miles)). The main drawback of using such 2.4Ghz modules for datalink is that it will interfere with the 2.4Ghz analog video transmitters and a inevitable decrease in range when in proximity to any wifi devices. For the plane, get the whip antenna version if you are not planning to build a custom antenna.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:Xbee_Pro_USB_RF_Modem.jpg|thumb|left|XBee Pro USB Stand-alone Modem (XBP24-PKC-001-UA)]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 2.4GHz&lt;br /&gt;
* Output Power 100mW (Xbee Pro)&lt;br /&gt;
* Sensitivity  -100 dBm &lt;br /&gt;
* RF Data Rate Up to 250 Kbps&lt;br /&gt;
* Interface data rate Up to 115.2 Kbps&lt;br /&gt;
* Power Draw (typical) 214 mA TX / 55 mA RX &lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 1500m line-of-sight &lt;br /&gt;
* Dimensions 24 x 33mm&lt;br /&gt;
* Weight 4 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Chip antenna, ¼ monopole integrated whip antenna or a U.FL antenna connector (3 versions)&lt;br /&gt;
* Price: 16€, Pro 26€&lt;br /&gt;
|&lt;br /&gt;
[[Image:XBee_pro.jpg|thumb|left|XBee Pro OEM Modem]]&lt;br /&gt;
|}&lt;br /&gt;
Mouser: [http://au.mouser.com/Search/ProductDetail.aspx?qs=sGAEpiMZZMtJacPDJcUJYzVn8vIv7g2fIpf5DCzJqko%3d 888-XBP24-PKC-001-UA]&amp;lt;br&amp;gt;&lt;br /&gt;
NOTE: If you wish to use this unit with another XBee type other than the 802.15.4 (i.e. XBee-PRO ZB) then purchase a modem with the U.fl connector.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/xbee-pro-oem-rf-module-zigbee.php  product page]&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/datasheet_XBee_OEM_RF-Modules.pdf  datasheet]&lt;br /&gt;
* [http://www.maxstream.net/products/xbee/product-manual_XBee_OEM_RF-Modules.pdf  user manual]&lt;br /&gt;
* To program your Xbee you need X-CTU you can download it [http://www.digi.com/support/productdetl.jsp?pid=3352&amp;amp;osvid=57&amp;amp;tp=5&amp;amp;s=316 here]. (only windows)&lt;br /&gt;
* explanation on X-CTU [http://www.ladyada.net/make/xbee/configure.html here].&lt;br /&gt;
* [http://ftp1.digi.com/support/firmware/update/xbee/ Drivers for XB24 and XBP24 modules]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro ZB / ZNet 2.5 (&amp;quot;Series 2&amp;quot;) ===&lt;br /&gt;
&lt;br /&gt;
The low-power XBee ZB and extended-range XBee-PRO ZB use the ZigBee PRO Feature Set for advanced mesh networking.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:XBee_Pro_2SB.jpg|thumb|left|Digi XBee Pro ZB]]&lt;br /&gt;
|&lt;br /&gt;
* Low-cost, low-power mesh networking&lt;br /&gt;
* Interoperability with ZigBee PRO Feature Set devices from other vendors*&lt;br /&gt;
* Support for larger, more dense mesh networks&lt;br /&gt;
* 128-bit AES encryption&lt;br /&gt;
* Frequency agility&lt;br /&gt;
* Over-the-air firmware updates (change firmware remotely)&lt;br /&gt;
* ISM 2.4 GHz operating frequency&lt;br /&gt;
* XBee: 2 mW (+3 dBm) power output (up to 400 ft RF LOS range)&lt;br /&gt;
* XBee-PRO: 50 mW (+17 dBm) power output (up to 1 mile RF LOS range)&lt;br /&gt;
* RPSMA connector, U.FL connector, Chip antenna, or Wired Whip antenna&lt;br /&gt;
* price : 14€, Pro 28€&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
These are available from Mouser:&amp;lt;br&amp;gt;&lt;br /&gt;
[http://au.mouser.com/Search/Refine.aspx?Keyword=888-XBP24-Z7WIT-004 888-XBP24-Z7WIT-004] XBee-PRO ZB with whip antenna&amp;lt;br&amp;gt;&lt;br /&gt;
[http://au.mouser.com/Search/Refine.aspx?Keyword=XBP24-Z7SIT-004 888-XBP24-Z7SIT-004] XBee-PRO ZB with RPSMA&lt;br /&gt;
&lt;br /&gt;
See [[XBee_configuration|XBee Configuration]] for setup.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/zigbee-mesh/xbee-zb-module.jsp http://www.digi.com/products/wireless/zigbee-mesh/xbee-zb-module.jsp]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro 868 ===&lt;br /&gt;
&lt;br /&gt;
'''WARNING - THESE MODEMS HAVE A 10% DUTY CYCLE, AND CURRENTLY HAVE SEVERE ISSUES WITH PAPARAZZI'''&lt;br /&gt;
&lt;br /&gt;
868MHz is a limited band. Please read the [[868MHz Issues]]&lt;br /&gt;
&lt;br /&gt;
XBee-PRO 868 modules are long range embedded RF modules for European applications. Purpose-built for exceptional RF performance, XBee-PRO 868 modules are ideal for applications with challenging RF environments, such as urban deployments, or where devices are several kilometers apart.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:xbeeproxsc-rpsma.jpg|thumb|left|Maxstream XBee Pro 868]]&lt;br /&gt;
|&lt;br /&gt;
* 868 MHz short range device (SRD) G3 band for Europe&lt;br /&gt;
* Software selectable Transmit Power&lt;br /&gt;
* 40 km RF LOS w/ dipole antennas&lt;br /&gt;
* 80 km RF LOS w/ high gain antennas (TX Power reduced)&lt;br /&gt;
* Simple to use peer-to-peer/point-to-mulitpoint topology&lt;br /&gt;
* 128-bit AES encryption&lt;br /&gt;
* 500 mW EIRP&lt;br /&gt;
* 24 kbps RF data rate&lt;br /&gt;
* price : ~70 USD&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
See [[XBee_configuration#XBee_Pro_868_MHZ|XBee Configuration]] for setup.&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/point-multipoint/xbee-pro-868.jsp http://www.digi.com/products/wireless/point-multipoint/xbee-pro-868.jsp]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee 868LP ===&lt;br /&gt;
&lt;br /&gt;
XBee 868LP modules are a low-power 868 MHz RF module for use in Europe. The range is shorter than it's brother the XBee PRO-868, but it can use the 868 G4 band with hopping which does not have restrictions on it's duty cycle. This is a big advantage if one want to have a good stream of telemetry data&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:868lp.jpg|thumb|left|XBee 868LP]]&lt;br /&gt;
|&lt;br /&gt;
* 868 MHz short range device (SRD) G4 band for Europe&lt;br /&gt;
* 4 km RF LOS w/ u.fl antennas&lt;br /&gt;
* 5 mW EIRP&lt;br /&gt;
* 10 or 80 kbps RF data rate&lt;br /&gt;
* price : 18€&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-868lp#overview http://www.digi.com/products/wireless-wired-embedded-solutions/zigbee-rf-modules/zigbee-mesh-module/xbee-868lp#overview]&lt;br /&gt;
&lt;br /&gt;
==== Trial ====&lt;br /&gt;
&lt;br /&gt;
With a quickly crafted and not optimal positioned antenna on the airframe we managed to get the advertised 4000 meter range. Data throughput was not high and the Iridium Telemetry XML configuration document was therefore used. All in all, cheap, easy to setup, pin compatible with regular modules and quite a range and usable in Europe without hassle.&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro 900HP  ===&lt;br /&gt;
* Frequency band 900Mhz&lt;br /&gt;
* RF rate 10 or 200 kbps&lt;br /&gt;
* up to 250mW output power&lt;br /&gt;
* 5 to 8 grams&lt;br /&gt;
* price: 32€&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
[http://ftp1.digi.com/support/documentation/90002173_H.pdf http://ftp1.digi.com/support/documentation/90002173_H.pdf]&lt;br /&gt;
&lt;br /&gt;
=== Digi XBee Pro XSC 900MHz ===&lt;br /&gt;
&lt;br /&gt;
Maxstream has recently announced a promising new line of modems combining the small size and low cost of their popular Xbee line with the long range and 2.4 GHz video compatibility of their high end 900 MHz models.  Sounds like the perfect modem for anyone who can use 900 MHz.  Give them a try and post your results here!&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|[[Image:xbeeproxsc-rpsma.jpg|thumb|left|Maxstream XBee Pro XSC]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 900 MHz&lt;br /&gt;
* Output Power 100 mW (+20 dBm)&lt;br /&gt;
* Sensitivity  -100 dBm &lt;br /&gt;
* RF Rate: 10 or 20 kbps&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 24km (15 miles) line-of-sight &lt;br /&gt;
* Interface 20-pin mini connector (Xbee compatible pinout)&lt;br /&gt;
* RPSMA, integrated whip antenna or U.FL antenna connector (3 versions)&lt;br /&gt;
* price : 32€&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
* [http://www.digi.com/products/wireless/point-multipoint/xbee-pro-xsc.jsp http://www.digi.com/products/wireless/point-multipoint/xbee-pro-xsc.jsp]&lt;br /&gt;
&lt;br /&gt;
==== Trials ====&lt;br /&gt;
Tested one today and it worked great. Going to try a multiUAV test with it soon&lt;br /&gt;
--Danstah&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
MultiUAV tests concluded this is probably not the best module to use. Even though it says you can change the baudrate inside x-ctu that is not the case, it is fixed at 9600 bps. This is a great modem however for single UAV's and I do recommend.&lt;br /&gt;
--Danstah&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Why would the European (868 MHz) be good to 24kbps and this only to 9600?  When I was altering my XBees (2.4Ghz Pro's) I had this problem altering baud rates until I read you have to send a &amp;quot;commit and reboot&amp;quot; type command after setting the baud rate. Could this be the case? --GR&lt;br /&gt;
&lt;br /&gt;
=== Digi 9XTend ===&lt;br /&gt;
&lt;br /&gt;
These larger units have been tested on the 900Mhz band, but are also available in 2.4Ghz.  They are a bit on the heavy side, about 20 grams, but give good performance at range. They have adjustable transmit power settings from 100mW to 1W.  Testing has shown range up to 5.6km (3.5 Miles) with XTend set to 100mW with small 3.1dB dipole antenna.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
[[Image:XTend_USB_RF_Modem.jpg|frame|left|9XTend USB Modem]]&lt;br /&gt;
|&lt;br /&gt;
* Frequency Band 900Mhz and 2.4Ghz (2 versions)&lt;br /&gt;
* Output Power 1mW to 1W software selectable&lt;br /&gt;
* Sensitivity  -110 dBm (@ 9600 bps)&lt;br /&gt;
* RF Data Rate 9.6 or 115.2 Kbps&lt;br /&gt;
* Interface data rate up to 230.4 Kbps&lt;br /&gt;
* Power Draw (typical) 730 mA TX / 80 mA RX &lt;br /&gt;
* Supply Voltage 2.8 to 5.5v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 64km line-of-sight &lt;br /&gt;
* Dimensions 36 x 60 x 5mm&lt;br /&gt;
* Weight 18 grams&lt;br /&gt;
* Interface 20-pin mini connector or USB&lt;br /&gt;
* RF connector RPSMA (Reverse-polarity SMA) or MMCX (2 versions)&lt;br /&gt;
* price : 150€&lt;br /&gt;
|&lt;br /&gt;
[[Image:Xtend_module.jpg|frame|left|9XTend OEM Modem]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Pinout ====&lt;br /&gt;
&lt;br /&gt;
[[Image:Maxstream_9XTend_Pinout.gif|thumb|left|Maxstream 9XTend Pinout]]&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''9XTend 20-pin Header'''''||'''''Name'''''||'''''Tiny Serial-1 Header'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
||1||GND||1 (GND)||Ground &lt;br /&gt;
|-&lt;br /&gt;
||2||VCC||2 (5V)||5V power (150mA - 730mA Supplied from servo bus or other 5V source)&lt;br /&gt;
|-&lt;br /&gt;
||5||RX||8 (TX)||3-5V TTL data input - connect to Tiny TX&lt;br /&gt;
|-&lt;br /&gt;
||6||TX||7 (RX)||5V TTL data output - connect to Tiny RX&lt;br /&gt;
|-&lt;br /&gt;
||7||Shutdown||2||This pin must be connected to the 5V bus for normal operation&lt;br /&gt;
|}&lt;br /&gt;
Notes:&amp;lt;br&amp;gt;&lt;br /&gt;
* 9XTend can run on voltages as low as 2.8V but users are strongly advised against connecting any modem (especially high power models) to the sensitive 3.3V bus supplying the autopilot processor and sensors.&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Documentation ====&lt;br /&gt;
&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/oem-rf-module.php product page]&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/datasheet_XTend_OEM_RF-Module.pdf datasheet]&lt;br /&gt;
* [http://www.maxstream.net/products/xtend/product-manual_XTend_OEM_RF-Module.pdf user manual]&lt;br /&gt;
&lt;br /&gt;
==== Configuration ====&lt;br /&gt;
&lt;br /&gt;
These modems need to be carefully configured based on your usage scenario to obtain the best possible range and link quality. In addition, it is always good to make sure the firmware is up to date.&lt;br /&gt;
&lt;br /&gt;
Some typical configurations that may work well, but can still depend your particular situation, are given below. For further details, be sure to consult the XTend users manual. Your application may need a different or modified configuration. The radiomodems do not need identical settings and can in fact be optimized with different settings. A good example is delays and retries: if each radio has the same number of retries and no delay, when a collision occurs each will continuously try to re-transmit, locking up the transmission for some time with no resolution or successful packet delivery. Instead, it is best to set the module whose data should have a lower latency to have no delay and a lower number of retries, while the other module has a delay set (RN &amp;gt; 0) and a greater number of retries. See acknowledged mode example below.&lt;br /&gt;
&lt;br /&gt;
* Acknowledged Polling Mode ('''Recommended'''):&lt;br /&gt;
** This causes one radio to be the base and the other(s) to be the remote(s). It eliminates collisions because remotes do not send data unless requested by the base. It can work in acknowledged mode (RR&amp;gt;0), basic reliable mode (MT&amp;gt;0) or in basic mode (no acknowledgement or multiple packets). It is recommended that the lower latency and/or higher data rate side be configured as the base (i.e. if you are sending lots of telemetry then the air module configured as the base is probably a good idea, but if you are using datalink joystick control, the ground side might be better as the base. It may require some experimentation).&lt;br /&gt;
* Acknowledged Point-to-(Multi)Point Mode:&lt;br /&gt;
** Each radio sends a packet and requests and acknowledgement that the packet was sent from the receiving side. The retries and delays must be set appropriately to ensure packet collisions are dealt with appropriately. It can also work without acknowledgements in basic reliable mode (MT&amp;gt;0) without any acknowledgements (RR=0, MT=0). Some experimentation may be required.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''Setting Name'''''||colspan=&amp;quot;2&amp;quot;|'''''Acknowledged Mode'''''||colspan=&amp;quot;2&amp;quot;|'''''Polling Mode (Acknowledged)'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
|| ||'''''Airside Module'''''||'''''Groundside Module'''''||'''''Base Module'''''||'''''Remote Module'''''||&lt;br /&gt;
|-&lt;br /&gt;
||BD||6||6||6||6||Adjust to match your configured autopilot and ground station baud rates (default for these is 57600bps)&lt;br /&gt;
|-&lt;br /&gt;
||DT||default||default||0x02||0x01||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||MD||default||default||3 (0x03)||4 (0x04)||&lt;br /&gt;
|-&lt;br /&gt;
||MT||0||0||0||0||Use this to enable Basic Reliable transmission, link bandwidth requirement increases (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||MY||default||default||0x01||0x02||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PB||default||default||0x02||default||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PD||default||default||default||default||Can be adjusted to increase polling request rate and DI buffer flush timeout (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PE||default||default||0x02||default||Can be adjusted if consistency maintained across addressing functionalities (see manual)&lt;br /&gt;
|-&lt;br /&gt;
||PL||default||default||default||default||''Transmit power level should be reduced for lab testing!!''&lt;br /&gt;
|-&lt;br /&gt;
||RN||0 (0x00)||8 (0x08)||default||default||&lt;br /&gt;
|-&lt;br /&gt;
||RR||6 (0x06)||12 (0x0C)||6 (0x06)||12 (0x0C)||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Note:''' All settings are assumed to be default except those listed. Those listed are in decimal unless hex 0x prefix included. Depending on your firmware version, slight modifications may be necessary.&lt;br /&gt;
&lt;br /&gt;
Here is some additional information and alternative instructions to configure the polling mode from the Digi site: [http://www.digi.com/support/kbase/kbaseresultdetl?id=2178 Polling Mode for the 9XTend Radio Modem]&lt;br /&gt;
&lt;br /&gt;
== SiLabs Si1000 SoC based modems ==&lt;br /&gt;
&lt;br /&gt;
[[Image:R0_V1_1_Top_Prototype.jpeg|thumb|left|R0 Sub GHz Telemetry Radio Modem]]&lt;br /&gt;
&lt;br /&gt;
The Si1000 - Si102x/3x radio System on Chip (SOC) produced by  SiLabs is found in a number of radio modules, for example the cheap and widely used HopeRf module. There is paparazzi fork of [https://github.com/paparazzi/SiK open source firmware] for these radios which makes them suitable for use in MAVs. Online documentation for the Sik firmware shows how to configure it for various jurisdictions. The firmware supports 433 MHz, 470 MHz, 868 MHz and 900 MHz radios. The new RFD868 also works in the European spectrum licenses (868 MHz). The latest SiK firmware supports also mesh topologies.&lt;br /&gt;
&lt;br /&gt;
Sik firmware can be used for example for:&lt;br /&gt;
* powerful [http://rfdesign.com.au/products/rfd900-modem/ RFD 900+] modem. RFD 900+ is well proven and supports antenna diversity. A combination of 6dbi Yagi plus a dipole on the ground station, with a pair of orthogonality oriented dioples in the airframe, has been extensively tested and proven reliable at &amp;gt;8km range (theoretical range of &amp;gt; ~40km).&lt;br /&gt;
* cheap and ubiquitous [http://ardupilot.org/copter/docs/common-3dr-radio-v1.html 3DR radios]&lt;br /&gt;
* for shorter range a pair of HopeRF-based modems such as the [[R0]] sub GHz telemetry radio modem. It was developed by [[1BitSquared]] specifically for the use with the Paparazzi UAV framework and is part of the [[Elle]] avionics system&lt;br /&gt;
&lt;br /&gt;
The RFD900 can be paired with the [[R0]] radio that has only a single front-end. You can for example, use a small short range airframe with a ground station that is also used for long range operations.&lt;br /&gt;
&lt;br /&gt;
=== Paparazzi SiK Firmware &amp;amp; RSSI===&lt;br /&gt;
Paparazzi has a modified fork of Sik firmware: https://github.com/paparazzi/SiK&lt;br /&gt;
&lt;br /&gt;
When using a SiK firmware radio with Paparazzi, you should set MavLink packing off ([https://github.com/paparazzi/SiK/blob/pprz_rssi/Firmware/radio/parameters.c#L63 set MAVLINK=0 here])and configure Paparazzi for transparent serial mode. You can also turn on an optional ''RSSI_COMBINED'' message that shows local and remote RSSI. To do that (and make Sik radio aware of Pprzlink packets) follow the instructions [https://github.com/paparazzi/SiK#paparazzi-rssi-enable here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
    &amp;lt;message name=&amp;quot;RSSI_COMBINED&amp;quot; id=&amp;quot;39&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;field name=&amp;quot;remote_rssi&amp;quot; type=&amp;quot;uint8&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;field name=&amp;quot;tx_power&amp;quot; type=&amp;quot;uint8&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;field name=&amp;quot;local_rssi&amp;quot; type=&amp;quot;uint8&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;field name=&amp;quot;local_noise&amp;quot; type=&amp;quot;uint8&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;field name=&amp;quot;remote_noise&amp;quot; type=&amp;quot;uint8&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/message&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Laird (ex Aerocom) ==&lt;br /&gt;
Lairds's API mode is already implemented but some system integration is required. Full API more with addressed packets works well and was tested with AC4790-1x1 5mW low power modules. Maximim range achieved with a whip quater-wave antenna was 1Km.&lt;br /&gt;
&lt;br /&gt;
How to use this modem on ground station side? [http://paparazzi.enac.fr/wiki/index.php/User:SilaS#SDK-AC4868-250_ground_modem_part]&lt;br /&gt;
&lt;br /&gt;
See folder paparazzi3 / trunk / sw / aerocomm. It has all the required files to use this modem on the airborne and ground station side. The link.ml file is a direct replacement of the &amp;quot;main&amp;quot; link.ml file of the ground sttaion and will be merged into it in the future.. or you can do it as well.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
=== AC4790-200 ===&lt;br /&gt;
* Frequency 902-928MHz (North America, Australia, etc).&lt;br /&gt;
* Output Power 5-200mW&lt;br /&gt;
* Sensitivity (@ full RF data rate) -110dB&lt;br /&gt;
* RF Data Rate up to 76.8 Kbps&lt;br /&gt;
* INterface Data Rate Up to Up to 115.2 Kbps &lt;br /&gt;
* Power Draw (typical) 68 mA&lt;br /&gt;
* Supply Voltage 3.3v &amp;amp; 5.5V&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 6.4 kilometers line-of-sight &lt;br /&gt;
* Dimensions 42 x 48 x 5mm &lt;br /&gt;
* Weight &amp;lt; 20 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Antenna MMCX jack Connector or internal&lt;br /&gt;
* price : 52€&lt;br /&gt;
|&lt;br /&gt;
[[Image:ac4868_transceiver.jpg|thumb|left|AC4868 OEM Modem]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
=== AC4790-1000 ===&lt;br /&gt;
* Frequency 902-928MHz (North America, Australia, etc).&lt;br /&gt;
* Output Power 5-1000mW&lt;br /&gt;
* Sensitivity (@ full RF data rate) -99dB&lt;br /&gt;
* RF Data Rate up to 76.8 Kbps&lt;br /&gt;
* INterface Data Rate Up to Up to 115.2 Kbps &lt;br /&gt;
* Power Draw (typical) 650 mA&lt;br /&gt;
* Supply Voltage 3.3V only&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) Up to 32 kilometers with high-gain antenna&lt;br /&gt;
* Dimensions 42 x 48 x 5mm &lt;br /&gt;
* Weight &amp;lt; 20 grams&lt;br /&gt;
* Interface 20-pin mini connector  &lt;br /&gt;
* Antenna MMCX jack Connector&lt;br /&gt;
* price : 64€&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Pinout ===&lt;br /&gt;
&lt;br /&gt;
[[Image:Aerocomm_AC4868_pinout.jpg|thumb|left|Laird AC4868 modem pinout]]&lt;br /&gt;
[[Image:Aerocomm_AC4490-200_wired.jpg|thumb|left|Laird AC4490 wiring example]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Wiring the Laird AC4868 to the Tiny&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||'''''AC4868 20-pin Header'''''||'''''Name'''''||'''''Color'''''||'''''Tiny v1.1 Serial-1'''''||'''''Tiny v2.11 Serial'''''||'''''Notes'''''&lt;br /&gt;
|-&lt;br /&gt;
||2||Tx||green||7||7||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||3||Rx||blue||8||8||''(Note 1)''&lt;br /&gt;
|-&lt;br /&gt;
||5||GND||black||1||1|| -&lt;br /&gt;
|-&lt;br /&gt;
||10+11||VCC||red||2||3||+3.3v ''(Note 2)''&lt;br /&gt;
|-&lt;br /&gt;
||17||C/D||white||3||?||Low = Command High = Data&lt;br /&gt;
|}&lt;br /&gt;
''Note 1 : names are specified with respect to the AEROCOMM module''&lt;br /&gt;
&lt;br /&gt;
''Note 2 : AC4790-1000 needs pins 10 and 11 jumped to work properly''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Laird RM024 ===&lt;br /&gt;
[[Image:Laird_LT2510_RM024-P125-C-01-side.jpg|thumb|RM024 P125]]&lt;br /&gt;
[[Image:Lt2510_prm123.jpg|thumb|LT2510 Modem]]&lt;br /&gt;
The RM024 replaces the discontinued LT2510 (they are backwards compatible).&lt;br /&gt;
&lt;br /&gt;
General features:&lt;br /&gt;
* Frequency Band 2.4GHz&lt;br /&gt;
* Output Power 2,5mW - 125mW&lt;br /&gt;
* Sensitivity  -98dbm @ 280kbps/-94 dBm @ 500kbps&lt;br /&gt;
* RF Data Rate 280/500 kbps&lt;br /&gt;
* UART up to 460800 baud&lt;br /&gt;
* Power Draw 90mA - 180mA TX / 10mA RX&lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range up to 4000m&lt;br /&gt;
* Dimensions 26 x 33 x 4mm&lt;br /&gt;
* Weight 4 grams&lt;br /&gt;
* Interface 20-pin mini connector (smd solder pad or XBee compatible pin header)&lt;br /&gt;
* Chip antenna, U.FL antenna connector or both&lt;br /&gt;
* Price: 29-31€ @ mouser (SMD / XBEE header)&lt;br /&gt;
&lt;br /&gt;
Two different mounting/pinuts are available:&amp;lt;br/&amp;gt;&lt;br /&gt;
* smd version: can be soldered on a pcb&amp;lt;br/&amp;gt;&lt;br /&gt;
* pin header: standard XBEE pinout (this is the SMD version mounted on a seperate pcb with male pin headers)&lt;br /&gt;
&lt;br /&gt;
Available in two different output power versions:&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
||''value''||''50mW version''||''125mW version''&lt;br /&gt;
|-&lt;br /&gt;
|output power&lt;br /&gt;
| 2,5 mW - 50 mW&lt;br /&gt;
| 2,5 mW - 125 mW&lt;br /&gt;
|-&lt;br /&gt;
|output power dbm&lt;br /&gt;
|4 dbm - 17 dbm&lt;br /&gt;
|4 dbm - 21 dbm&lt;br /&gt;
|-&lt;br /&gt;
|TX drain&lt;br /&gt;
|90mA&lt;br /&gt;
|&amp;lt;180mA&lt;br /&gt;
|-&lt;br /&gt;
|max range (280kbps with 2 dbi antenna)&lt;br /&gt;
|2400m&lt;br /&gt;
|4000m&lt;br /&gt;
|-&lt;br /&gt;
|approval&lt;br /&gt;
|CE for EU, FCC/IC for USA,&lt;br /&gt;
Canada PRM122/123 also for Japan&lt;br /&gt;
|FCC/IC for USA, Canada &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The RM024 uses frequency hopping (FHSS) which needs a client/server model. That means that one modem (most appropriately the ground station modem) needs to be set to server mode. It will transmit a beacon message and have all client modems synchronize to that in a time and frequency hopping scheme manner. For that all modems need to have the same channel (in fact the hopping scheme) and system-id. Clients can be set to auto-channel and auto-system-id to follow any/the first visible server.&lt;br /&gt;
&lt;br /&gt;
====Documentation====&lt;br /&gt;
[http://www.lairdtech.com/WorkArea/DownloadAsset.aspx?id=2147488576 RM024 User Manual]&amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.lairdtech.com/WorkArea/linkit.aspx?LinkIdentifier=id&amp;amp;ItemID=4379 LT2510 User Manual]&amp;lt;br/&amp;gt;&lt;br /&gt;
[http://www.lairdtech.com/zips/Developer_Kit.zip Windows configuration tool]&lt;br /&gt;
&lt;br /&gt;
'''Setup'''&lt;br /&gt;
&lt;br /&gt;
Look at the [[Laird_RM024_setup page]]&lt;br /&gt;
&lt;br /&gt;
== Bluetooth ==&lt;br /&gt;
These modems do not give you a great range but Bluetooth can be found in a lot of recent laptops built-in. Maybe not useful for fixed wing aircrafts it might be used for in-the-shop testing or quadcopters. Make sure you get a recent Class 1 EDR 2.0 stick if you buy one for your computer.&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
=== RN-41 Bluetooth module(Sparkfun's WRL-08497) ===&lt;br /&gt;
* Frequency Band 2.4GHz&lt;br /&gt;
* Output Power 32 mW &lt;br /&gt;
* RF Data Rate up to ~300 kbps in SPP&lt;br /&gt;
* Interface Data Rate up to 921 kbps &lt;br /&gt;
* Power Draw (typical) 50 mA TX / 40 mA RX &lt;br /&gt;
* Supply Voltage 3.3v&lt;br /&gt;
* Range (typical, depends on antenna &amp;amp; environment) 100 meters line-of-sight &lt;br /&gt;
* Dimensions 26 x 13 x 2mm &lt;br /&gt;
* Weight ~1.5 grams&lt;br /&gt;
* Interface solder connector  &lt;br /&gt;
* price : 20€&lt;br /&gt;
|&lt;br /&gt;
[[Image:roving_nw_wiring.jpg|thumb|Roving Networks modem wiring]]&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
To connect to it, get the MAC address of the bluetooth modem&lt;br /&gt;
&lt;br /&gt;
 me@mybox:~$ hcitool scan&lt;br /&gt;
 Scanning ...&lt;br /&gt;
        00:06:66:00:53:AD       FireFly-53AD&lt;br /&gt;
&lt;br /&gt;
either make a virtual connection to a Bluetooth serial port each time you connect&lt;br /&gt;
&lt;br /&gt;
 sudo rfcomm bind 0 00:06:66:00:53:AD&lt;br /&gt;
&lt;br /&gt;
or configure it once in /etc/bluetooth/rfcomm.conf&lt;br /&gt;
&lt;br /&gt;
 rfcomm0 {&lt;br /&gt;
   bind yes;&lt;br /&gt;
   device 00:06:66:00:53:AD;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
now you can use Bluetooth as '''/dev/rfcomm0''' with the Paparazzi 'link'. You might need to restart 'link' in case you get out of range and it disconnects (tbd). Set the Tiny serial speed to 115200 as the modules come preconfigured to that.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== WiFi ==&lt;br /&gt;
&lt;br /&gt;
== ESP8266 Chip Module ==&lt;br /&gt;
&lt;br /&gt;
[[File:ESP8266.jpg|thumbnail|left|ESP8266 WiFi module]]&lt;br /&gt;
&lt;br /&gt;
=== ESP as client ===&lt;br /&gt;
The WiFi chip tries to connect to a hotspot or router. The GCS is connected to the same network. No additional tools are required on the GCS computer.&lt;br /&gt;
See https://github.com/paparazzi/esp8266_udp_firmware for installation and usage instructions&lt;br /&gt;
&lt;br /&gt;
=== ESP as host ===&lt;br /&gt;
&lt;br /&gt;
Change the config of the software to use Host and set the preferred SSID and if wanted the PW and reflash the module&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telemetry via Video Transmitter==&lt;br /&gt;
&lt;br /&gt;
[[Image:video_tx_small.jpg|thumb|2.4GHz Video Transmitter]]&lt;br /&gt;
In order for the UAV to transmit video from an onboard camera, an analog video transmitter can be used.  These vary in power, and thus range, and run normally on 2.4Ghz.  Small UAVs can get about 600m of range from the 50mW version, and extended range can be achieved using units up to 1W.  Weight for these units varies from a couple grams to about 30 for the 1W with shielding.  Please check for your countries regulations on 2.4Ghz transmission, as each is different. &lt;br /&gt;
&lt;br /&gt;
It is possible to use the audio channel to send simple telemetry data to the groundstation. Uploading telemetry not possible via analog audio transmitter only.&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Antennas ==&lt;br /&gt;
&lt;br /&gt;
Here are some examples of lightweight and efficient 868MHz antennas developped by the RF laboratory at ENAC.&lt;br /&gt;
[[Image:868mhz_twinstar_antenna_1.jpg|thumb|left|868MHz copper foil antenna attached to the aircraft tail]] &lt;br /&gt;
[[Image:868mhz_twinstar_antenna_2.jpg|thumb|left|868MHz copper foil antenna bottom view]] &lt;br /&gt;
[[Image:868mhz_ground_antenna.jpg|thumb|left|868MHz ground antenna]] &lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This wiki page might give some ideas about antennas: http://en.wikipedia.org/wiki/Dipole_antenna&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24012</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24012"/>
		<updated>2018-03-14T23:47:25Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
'''Update March 2018: HITL currently works only with Pprzlink 1.0, please recompile paparazzi with PPRZLINK_LIB_VERSION=1.0. We are working on a fix.'''&lt;br /&gt;
&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
HITL currently (Ubuntu 16.04) needs the following two steps to run correctly:&lt;br /&gt;
* set rtpriority for the uart threads [https://stackoverflow.com/questions/8111302/why-does-pthread-setschedparam-produce-eperm-on-opensuse-11-4 detailes here] by adding these two lines to your ''/etc/security/limits.conf'' file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
$USER       soft    rtprio   100&lt;br /&gt;
$USER       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where ''$USER'' is your username&lt;br /&gt;
&lt;br /&gt;
* install ''pyserial'' package (needed for SBUS Fakerator), typically with ''sudo install pyserial''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input (provides position and orientation data, including GPS coordinates)&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use your own session, you have to pass ''-t hitl'' flag into ''sw/simulator/pprzsim-launch'' to start in HITL mode. Have a look at the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_control_panel.xml#L126 HITL USB-serual@57600] session for example, or add this to your own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your control_panel.xml file&lt;br /&gt;
&amp;lt;session&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
     &amp;lt;program name=&amp;quot;Simulator&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-a&amp;quot; constant=&amp;quot;@AIRCRAFT&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-f&amp;quot; constant=&amp;quot;127.0.0.1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-b&amp;quot; constant=&amp;quot;127.255.255.255&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;--fg_fdm&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-t&amp;quot; constant=&amp;quot;hitl&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/program&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/session&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Minion_HITL.png|600px|center|Minion in the air]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24011</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=24011"/>
		<updated>2018-03-14T23:46:02Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: added info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
'''Update March 2018: HITL currently works only with Pprzlink 1.0, please recompile paparazzi with PPRZLINK_LIB_VERSION=1.0. We are working on a fix.'''&lt;br /&gt;
&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
HITL currently (Ubuntu 16.04) needs the following two steps to run correctly:&lt;br /&gt;
* set rtpriority for the uart threads [https://stackoverflow.com/questions/8111302/why-does-pthread-setschedparam-produce-eperm-on-opensuse-11-4 detailes here] by adding these two lines to your ''/etc/security/limits.conf'' file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
domain       type    item     value&lt;br /&gt;
$USER       soft    rtprio   100&lt;br /&gt;
$USER       hard    rtprio   100&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
where ''$USER'' is your username&lt;br /&gt;
&lt;br /&gt;
* install ''pyserial'' package (needed for SBUS Fakerator), typically with ''sudo install pyserial''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input (provides position and orientation data, including GPS coordinates)&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use your own session, you have to pass ''-t hitl'' flag into ''sw/simulator/pprzsim-launch'' to start in HITL mode. Have a look at the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_control_panel.xml#L126 HITL USB-serual@57600] session for example, or add this to your own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your control_panel.xml file&lt;br /&gt;
&amp;lt;session&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
     &amp;lt;program name=&amp;quot;Simulator&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-a&amp;quot; constant=&amp;quot;@AIRCRAFT&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-f&amp;quot; constant=&amp;quot;127.0.0.1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-b&amp;quot; constant=&amp;quot;127.255.255.255&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;--fg_fdm&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-t&amp;quot; constant=&amp;quot;hitl&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/program&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/session&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Minon_HITL.png|500px|left]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Minion_HITL.png&amp;diff=24010</id>
		<title>File:Minion HITL.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Minion_HITL.png&amp;diff=24010"/>
		<updated>2018-03-14T23:42:40Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23986</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23986"/>
		<updated>2017-12-29T03:53:54Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Types */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==&lt;br /&gt;
Secure Paparazzi link ([https://github.com/paparazzi/pprzlink/tree/hacl-c pprzlink]) uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm, refer there for more details about the algorithm itself.&lt;br /&gt;
&lt;br /&gt;
The cryptographic overhead during regular communication is 20 bytes (4 bytes of the counter, 16 bytes of the authentication tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case both source and destination ID are not encrypted (but are authenticated).&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
         i counter LSB 1&lt;br /&gt;
        ii counter LSB 2&lt;br /&gt;
       iii counter LSB 3&lt;br /&gt;
        iv counter LSB 4&lt;br /&gt;
             0 SOURCE (~sender_ID)&lt;br /&gt;
             1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
             2 CLASS/COMPONENT&lt;br /&gt;
               bits 0-3: 16 class ID available&lt;br /&gt;
               bits 4-7: 16 component ID available&lt;br /&gt;
             3 MSG_ID&lt;br /&gt;
             4 MSG_PAYLOAD&lt;br /&gt;
             . DATA (messages.xml)&lt;br /&gt;
       i-xvi TAG&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23985</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23985"/>
		<updated>2017-12-29T03:48:00Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==&lt;br /&gt;
Secure Paparazzi link ([https://github.com/paparazzi/pprzlink/tree/hacl-c pprzlink]) uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm, refer there for more details about the algorithm itself.&lt;br /&gt;
&lt;br /&gt;
The cryptographic overhead during regular communication is 20 bytes (4 bytes of the counter, 16 bytes of the authentication tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| sender ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|8..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case both source and destination ID are not encrypted (but are authenticated).&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=23983</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=23983"/>
		<updated>2017-12-12T04:06:51Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzink =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs].&lt;br /&gt;
&lt;br /&gt;
[https://github.com/mitls/hacl-star HACL*] also has to be installed. Paparazzi provides a convenient [https://github.com/paparazzi/hacl-c snapshot] of the generated C code. To install HACL*, go to ''sw/ext/hacl-c'' and type:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
make&lt;br /&gt;
sudo cp libhacl.* /usr/local/lib/.&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=23981</id>
		<title>Pprzlink</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Pprzlink&amp;diff=23981"/>
		<updated>2017-12-11T00:50:33Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''PPRZLINK''' is the communication library used by the Paparazzi UAV project and other related projects.&lt;br /&gt;
&lt;br /&gt;
It provides:&lt;br /&gt;
* Bulleted list item&lt;br /&gt;
* a set of messages definitions&lt;br /&gt;
* various encapsulation protocols&lt;br /&gt;
* several high-level access to physical layers (serial, udp, [[Ivy]])&lt;br /&gt;
* several language support (Ocaml, C, Python)&lt;br /&gt;
&lt;br /&gt;
Source code can be download from Github: https://github.com/paparazzi/pprzlink&lt;br /&gt;
&lt;br /&gt;
The creation of PPRZLINK as a separated project from the main Paparazzi source code is the result of the [[Roadmap#Communication_Roadmap|communication roadmap]]. At the moment it is released under GPL v2, but it may be changed to LGPL in order to ease integration into third-party projects.&lt;br /&gt;
&lt;br /&gt;
A (not very complete) documentation is also available on the [https://pprzlink.readthedocs.io/en/latest/ readthedocs] platform.&lt;br /&gt;
&lt;br /&gt;
Some useful related project:&lt;br /&gt;
* [https://github.com/paparazzi/flyingrobotcommander Flying Robot Commander]: HMI to control several synchronized UAVs&lt;br /&gt;
* [https://github.com/enacuavlab/pprzros PPRZROS]: bridge for the ROS middleware&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Messages' definition =&lt;br /&gt;
&lt;br /&gt;
The messages are organized three main classes:&lt;br /&gt;
* ''telemetry'': messages sent by the aircraft, usually to the ground, a.k.a. downlink stream&lt;br /&gt;
* ''datalink'': messages sent by the ground to the aircraft, a.k.a. uplink&lt;br /&gt;
* ''ground'': messages exchanged between ground agents over the [[Ivy]] software bus&lt;br /&gt;
[[File:Pprz communication agents.gif]]&lt;br /&gt;
&lt;br /&gt;
The generated documentation is available here: http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
New messages can be integrated mainstream in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml messages xml file] from PPRZLINK. When using with Paparazzi, it is also possible to use an temporary file placed in the ''conf'' folder. If not present, the default set is used.&lt;br /&gt;
&lt;br /&gt;
= Protocols =&lt;br /&gt;
&lt;br /&gt;
== Principles ==&lt;br /&gt;
PPRZLINK is based on encapsulation. The first layer is the message level, mostly containing the data and the required information to decode them. The structure of this part is always the same. The second layer called ''transport'' can be changed according to the actual physical layer being used. The basic type (''pprz'') is just providing synchronization byte and checksum, but other transports offer more possibility of routing like the ''XBee' transport (especially the possibility to use point-to-point or broadcast).&lt;br /&gt;
&lt;br /&gt;
The message formats are described [[Messages_Format|here]]. A ''secured'' version is currently under development.&lt;br /&gt;
&lt;br /&gt;
== Differences between version 1 and 2 ==&lt;br /&gt;
&lt;br /&gt;
A new version (v2) have been developed to overcome several limitations. With version 1, only the message ID (1 byte) and the sender ID (1 byte) are provided in the message layer before the data part. It means that:&lt;br /&gt;
* messages can't be addressed to a particular receiver unless the transport layer can provide the service&lt;br /&gt;
* it is not possible to determine the class of messages, so it is assumed that telemetry messages are strictly downlink and datalink messages strictly uplink, thus preventing direct air-to-air communications&lt;br /&gt;
&lt;br /&gt;
With the version two of the protocol, two extra bytes have been added to the message header:&lt;br /&gt;
* the receiver ID (1 byte)&lt;br /&gt;
* a class ID (4 bits)&lt;br /&gt;
* a component ID (4 bits)&lt;br /&gt;
The class and component are part of the same byte. Even if the component ID is not really used at the moment (provision for future use), the class ID avoid ambiguities on messages. With the receiver ID, it is now possible to perform air-to-air communications and to broadcast messages from an aircraft (previously only possible from the ground).&lt;br /&gt;
&lt;br /&gt;
See [[Messages_Format|messages format]] page for more details.&lt;br /&gt;
&lt;br /&gt;
= Interfaces =&lt;br /&gt;
&lt;br /&gt;
Currently, the available interfaces are:&lt;br /&gt;
* serial stream&lt;br /&gt;
* udp packet&lt;br /&gt;
* [[Ivy]] based messages (publisher/subscriber middelware over TCP/IP, should only be used on the ground side)&lt;br /&gt;
&lt;br /&gt;
In addition a bridge to the [http://www.ros.org ROS] middleware is available at https://github.com/enacuavlab/pprzros&lt;br /&gt;
&lt;br /&gt;
== Language supports ==&lt;br /&gt;
&lt;br /&gt;
The supported languages are:&lt;br /&gt;
* C language&lt;br /&gt;
** generation of code (header files) for sending and decoding messages&lt;br /&gt;
** mostly used for the airborne code of Paparazzi&lt;br /&gt;
* Ocaml&lt;br /&gt;
** library based high-level functions for binding, subscribing and parsing messages&lt;br /&gt;
** mostly used by the ground station agents: links, GCS, server, ...&lt;br /&gt;
* Python&lt;br /&gt;
** Provide similar functionality than the Ocaml implemetation&lt;br /&gt;
** used in a large variety of smaller tools and ground agents&lt;br /&gt;
&lt;br /&gt;
= Secure Ppprzink =&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
Secure link requires [https://www.rust-lang.org/en-US/ Rust]. The recommended way to install Rust on your computer is via [https://www.rustup.rs/ rustup.rs].&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Mission_computer&amp;diff=23927</id>
		<title>Mission computer</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Mission_computer&amp;diff=23927"/>
		<updated>2017-11-27T19:57:38Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: added use cases for mission planner&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Copilot: a Mission Computer =&lt;br /&gt;
&lt;br /&gt;
''Copilot'' is a short name for a mission computer that can be used with Paparazzi. ''Mission computer'' is another computer being flown on the airplane. The autopilot (also called ''flight computer'') takes care of maintaining stable flight, running control loops and sensor fusion algorithms, and communicating with the [[GCS]]. The autopilot typically runs an RTOS or bare-metal on a small microcontroller (MCU), such as [[Lisa/M]] or [[Pixhawk]] and has limited memory and computational power.&lt;br /&gt;
&lt;br /&gt;
''Mission computer'' on the other hand is typically a more powerful computer with Linux OS, and more memory. It takes care of more complex tasks, such as data-logging (if the autopilot doesn't log data), system and mission monitoring and it can also change the flight plan and command the autopilot to fly somewhere else. ''Mission computer'' has also a couple of additional interfaces, such as ethernet, so it can create a local network on the airplane. &lt;br /&gt;
An example Mission computer hardware is [[Gumstix|Gumstix Overo]].&lt;br /&gt;
&lt;br /&gt;
A payload computer carries a payload - such as a camera array, and is the most powerful of all three computers. An example of a payload computer is [http://www.intel.com/content/www/us/en/nuc/overview.html Intel NUC].&lt;br /&gt;
&lt;br /&gt;
The payload computer communicates with the mission computer using [https://github.com/paparazzi/pprzlink pprzlink] messages over [[Ivy|Ivy bus]] on a local network. The mission computer is then connected to the autopilot over serial link and uses [https://github.com/paparazzi/pprzlink pprzlink]. The autopilot then communicates with the GCS over wireless [[Telemetry|telemetry]] link, using also [https://github.com/paparazzi/pprzlink pprzlink].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Copilot.png|1000px|thumb|center|System diagram showing the autopilot, mission computer and payload computer]]&lt;br /&gt;
&lt;br /&gt;
= So what is Copilot? =&lt;br /&gt;
The system described above is very general and can indeed be modified as needed. It is hard to make ''one-system-fits-all'' but it is good to have a basic template that can be used and extended as needed. And that is '''Copilot'''. Loosely based on ''ISaAC: The Intelligent Safety and Airworthiness Co-Pilot module'' described in paper [http://ieeexplore.ieee.org/abstract/document/6309316/ &amp;quot;A Payload Verification and Management Framework for Small UAV-based Personal Remote Sensing Systems&amp;quot;] by Cal Coopmans and Chris Coffin. Think of Copilot as a shortcut for Mission computer, and mission computer enabling software.&lt;br /&gt;
&lt;br /&gt;
''Copilot'' consists of three parts:&lt;br /&gt;
* autopilot module that sends and receives messages to/from the Mission computer&lt;br /&gt;
* a sample Copilot application running on the Mission computer itself, logging data and forwarding messages&lt;br /&gt;
* a sample payload application running on the Payload computer, that logs messages, and can request a change of a waypoint&lt;br /&gt;
&lt;br /&gt;
Below we describe how to use Copilot and how to tweak it to your needs.&lt;br /&gt;
&lt;br /&gt;
= Starting Copilot =&lt;br /&gt;
Since Copilot has three parts, we describe them in order. Note that you can use Copilot either as a [[Simulation|simulation]] on your localhost,&lt;br /&gt;
or deployed on real hardware (and optionally use [[HITL]]).&lt;br /&gt;
&lt;br /&gt;
== Paparazzi Autopilot ==&lt;br /&gt;
Get the latest version of paparazzi, as described in [[Installation]]. Then select ''Minion Lia'' airframe. You can use any other airframe too, just make sure you are using the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_rp3_lia.xml#L60 copilot] module.&lt;br /&gt;
&lt;br /&gt;
=== Simulation ===&lt;br /&gt;
Select '''NPS''' target, build and then hit '''Simulate'''.&lt;br /&gt;
&lt;br /&gt;
=== Flight ===&lt;br /&gt;
Select '''AP''' target, build and upload. Then start your USB-Serial@57600 session.&lt;br /&gt;
&lt;br /&gt;
Now you have the autopilot running, and you should be able to control it from GCS, send commands etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Copilot: Mission Computer ==&lt;br /&gt;
We assume that the mission computer is running Linux of some sort, and has the paparazzi packages [[Installation|installed]]. In case of embedded hardware, check [[Installation/BeagleBoneBlack]] or [[GettingTheGCSRunningonAGumstixBoard|GettingTheGCSRunningonAGumstixBoard ]].&lt;br /&gt;
&lt;br /&gt;
We use [https://github.com/podhrmic/ivy-cpp ivy-cpp] package, but if you prefer to write your own application in pure C, that is indeed possible.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
git clone git@github.com:podhrmic/ivy-cpp.git&lt;br /&gt;
cd ivy-cpp&lt;br /&gt;
make; sudo make install;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we need to copy ''messages.xml, messaxes.dtd'' and ''units.xml'' into ''/usr/share/pprzlink''&lt;br /&gt;
Do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
cd ~/paparazzi/sw/ext/pprzlink/message_definitions&lt;br /&gt;
sudo mkdir /usr/share/pprzlink&lt;br /&gt;
sudo cp common/units.xml /usr/share/pprzlink/.&lt;br /&gt;
sudo cp v1.0/messages.dtd /usr/share/pprzlink/.&lt;br /&gt;
sudo ln -s `pwd`/v1.0/messages.xml /usr/share/pprzlink&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(we want just a symlink to ''messages.xml'' because they might change in the future with the new commits in your paparazzi directory).&lt;br /&gt;
&lt;br /&gt;
=== Simulation ===&lt;br /&gt;
All you need to do for simulation is to execute the copilot binary on the same machine as you are running your paparazzi simulation. Change [https://github.com/podhrmic/ivy-cpp/blob/master/testCopilot.cxx#L9 DEBUG] flag to 1 and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
make testCopilot;&lt;br /&gt;
./testCopilot&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can specify the Ivy broadcast address (default is 127.255.255.255) with ''-b'' (type -h to get help). You should see something like this:&lt;br /&gt;
&amp;lt;nowki&amp;gt;&lt;br /&gt;
$./testCopilot&lt;br /&gt;
Broadcasting on network 127.255.255.255, port 2010&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
=== Flight ===&lt;br /&gt;
If you are flying (and are connected to the autopilot via serial port, we need to start 'link' to decode the serial protocol to Ivy messages and publish them on the bus.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
cd sw/ground_segment/tmtc&lt;br /&gt;
sudo ./link -d /dev/ttyUSB0 -s 921600 -b 10.0.0.255&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you substitute the serial device and the ivy bus address accordingly.&lt;br /&gt;
&lt;br /&gt;
Then compile and launch ''testCopilot'' (make sure you have [https://github.com/podhrmic/ivy-cpp/blob/master/testCopilot.cxx#L9 DEBUG] flag to 0):&lt;br /&gt;
&amp;lt;nowiki&amp;gt;&lt;br /&gt;
make testCopilot;&lt;br /&gt;
./testCopilot -b 127.255.255.255:2010&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Payload Computer: camera control software ==&lt;br /&gt;
We are using a simple test program called ''testAggieCap'' (it is named after AggieCap software that is used on [http://AggieAir http://aggieair.usu.edu/] airplanes). This simple program binds to messages of interest (such as GPS, ATTITUDE etc), sends periodically status update about its (here virtual) cameras and also requests a change of PAYLOAD waypoint (so it can steer the airplane to go where the payload needs to).&lt;br /&gt;
&lt;br /&gt;
The installation is similar to the Mission computer. After you install paparazzi, copy [https://github.com/podhrmic/ivy-cpp ivy-cpp] repo and ''make; make install;''&lt;br /&gt;
&lt;br /&gt;
=== Simulation ===&lt;br /&gt;
Change the [https://github.com/podhrmic/ivy-cpp/blob/master/testAggieCap.cxx#L28 DEBUG] flag to 1 and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
make testAggieCap&lt;br /&gt;
./testAggieCap&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Flight ===&lt;br /&gt;
Change the [https://github.com/podhrmic/ivy-cpp/blob/master/testAggieCap.cxx#L28 DEBUG] flag to 0 and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
make testAggieCap&lt;br /&gt;
./testAggieCap&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend launching [[Ivy#Ivyprobe|ivyprobe]] '(.*)' so you see what is going on. You should see something like this:&lt;br /&gt;
&lt;br /&gt;
[[File:Ivyprobe_payload_test.png|1000px|thumb|center|Payload computer running ivyprobe and testAggieCap]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Putting it together ==&lt;br /&gt;
When you have all three parts of Copilot running (doesn't matter if its simulation or real flight) you should see something like this on your GCS:&lt;br /&gt;
&lt;br /&gt;
[[File:Copilot-gcs.png|800px|thumb|center|GCS showing payload and camera status]]&lt;br /&gt;
[[File:Copilot-messages.png|300px|thumb|center|Messages showing relayed messages from the Payload computer]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Customizing Copilot =&lt;br /&gt;
Since Copilot is not meant to be a finished full featured system, but rather an architecture to build on, it is easy (and often necessary) to modify for a particular purpose. First and most important thing is probably changing which messages are being sent.&lt;br /&gt;
&lt;br /&gt;
== Pprzlink messages ==&lt;br /&gt;
If you want to send more messages to the Mission computer '''from''' the autopilot, just add them into your telemetry file, under the ''extra'' tag.&lt;br /&gt;
Example of such file is [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L120 here]&lt;br /&gt;
&lt;br /&gt;
If you want to send more message from the Mission computer '''to''' the autopilot, add appropriate message handlers to the copilot.xml module.&lt;br /&gt;
&lt;br /&gt;
If you want to add new messages to pprzlink, you can just edit your [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_rp3_lia.xml#L60 messages.xml] file. If you want to forward new messages from the payload/mission computer to the autopilot, you have to define them in the [https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml#L1930 'datalink'] class and declare them [http://forwarded https://github.com/paparazzi/pprzlink/blob/master/message_definitions/v1.0/messages.xml#L1943].&lt;br /&gt;
&lt;br /&gt;
== Expanding functionality ==&lt;br /&gt;
If you want to expand functionality of [https://github.com/podhrmic/ivy-cpp/blob/master/testCopilot.cxx testCopilot] or [https://github.com/podhrmic/ivy-cpp/blob/master/testAggieCap.cxx testAggieCap] you can just add your own callbacks and/or integrate the examples into your own application.&lt;br /&gt;
&lt;br /&gt;
If you have some cool code you would like to share, don't hesitate and make a pull request:)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Mission Computer Use cases =&lt;br /&gt;
&lt;br /&gt;
== Mission Planner == &lt;br /&gt;
''Mission planner'' is a process that runs on the Mission Computer and dynamically changes mission as needed. It utilizes [[Mission]] module that has to be running on the autopilot. The mission control is handed over to the mission planner when the ''mission_run()'' is executed from the flight plan. &lt;br /&gt;
&lt;br /&gt;
For example, a flight plan block called ''Mission'' is created as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=xml&amp;gt;&lt;br /&gt;
    &amp;lt;block name=&amp;quot;Mission&amp;quot; strip_button=&amp;quot;Mission&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;call fun=&amp;quot;mission_run()&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;deroute block=&amp;quot;Standby&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/block&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
&lt;br /&gt;
=== Vision based navigation ===&lt;br /&gt;
[[File:Mission_use_cases_1.png|900px|thumb|left|Mission planning with machine vision]]&lt;br /&gt;
&lt;br /&gt;
Assume we have a UAV with a camera connected to the mission computer, some image processing algorithm that detects targets in the acquired images, and Mission Planner process that patrols a specified area, and if a target is detected in the image, it guides the UAV to follow the target (using GOTO_WP messages). We also an event logger to log communication between processes. All processes are communicating over Ivy bus. A good practical example would be wildlife monitoring and tracking of poachers.&lt;br /&gt;
&lt;br /&gt;
Vision based mission can also be about autonomous area surveillance (for example after a natural disaster), the general framework would be the same.&lt;br /&gt;
&lt;br /&gt;
=== Payload driven mission ===&lt;br /&gt;
&lt;br /&gt;
Conceptually similar configuration occurs when there is a dedicated payload computer with a complex sensor (e.g. a camera array, high-resolution lidar, etc.). The payload is connected (typically over Ethernet) to the Ivy bus, and can issue messages for the mission computer (similar to the previous use case). A simple example:&lt;br /&gt;
&lt;br /&gt;
# payload requests to perform a survey over area A&lt;br /&gt;
# Mission Planner checks whether the area is in the allowed airspace (and no other aircrafts are nearby)&lt;br /&gt;
# Mission Planner checks whether the area can be surveyed with the current resources (remaining battery, flight speed, ...)&lt;br /&gt;
# Mission Planner decides whether to perform the survey, and informs both the Flight computer (GOTO_WP) and Payload computer&lt;br /&gt;
# (Optional): Mission planner can decide to survey only a part of the area&lt;br /&gt;
&lt;br /&gt;
=== Obstacle avoidance sensors ===&lt;br /&gt;
[[File:Mission_use_cases_2.png|900px|thumb|left|Mission planning with Obstacle avoidance modules]]&lt;br /&gt;
&lt;br /&gt;
Either of the previous cases can be augmented with on-board obstacle avoidance sensors, for example [http://aggieair.usu.edu/node/312 ADS-B] module. ADS-B receives position information about other aircrafts, and sends out its won position. Another obstacle avoidance sensor can be a short-range lidar, or a ultrasonic sensor array. In general, we can aggregate the sensors in a ''Obstacle Avoidance'' process.  &lt;br /&gt;
&lt;br /&gt;
=== Other scenarios ===&lt;br /&gt;
Indeed, this list is non-exhaustive and a number of other scenarios (or combination of all use cases above) is possible. If you are a curious reader, feel free to expand this list:-)&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Mission_use_cases_2.png&amp;diff=23926</id>
		<title>File:Mission use cases 2.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Mission_use_cases_2.png&amp;diff=23926"/>
		<updated>2017-11-27T19:51:59Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Mission_use_cases_1.png&amp;diff=23925</id>
		<title>File:Mission use cases 1.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Mission_use_cases_1.png&amp;diff=23925"/>
		<updated>2017-11-27T19:28:53Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23911</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23911"/>
		<updated>2017-11-04T21:09:37Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Paparazzi (S-PPRZ) for serial and transparent modem communication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==&lt;br /&gt;
Secure Paparazzi link ([https://github.com/paparazzi/pprzlink/tree/hacl-c pprzlink]) uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm, refer there for more details about the algorithm itself.&lt;br /&gt;
&lt;br /&gt;
The cryptographic overhead during regular communication is 20 bytes (4 bytes of the counter, 16 bytes of the authentication tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| sender ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|8..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case both source and destination ID are not encrypted (but are authenticated).&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v2.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| source ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3|| destination ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|8|| class component ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|9|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|10..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23910</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23910"/>
		<updated>2017-11-04T21:05:59Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Pprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==&lt;br /&gt;
Secure Paparazzi link ([https://github.com/paparazzi/pprzlink/tree/hacl-c pprzlink]) uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm, refer there for more details about the algorithm itself.&lt;br /&gt;
&lt;br /&gt;
The cryptographic overhead during regular communication is 20 bytes (4 bytes of the counter, 16 bytes of the authentication tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2|| sender ID ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|7|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|8..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23909</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23909"/>
		<updated>2017-11-04T02:41:58Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Paparazzi (S-PPRZ) for serial and transparent modem communication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==&lt;br /&gt;
Secure Paparazzi link ([https://github.com/paparazzi/pprzlink/tree/hacl-c pprzlink]) uses [https://en.wikipedia.org/wiki/Symmetric-key_algorithm symmetric key encryption] with [https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant Chacha20] cipher.&lt;br /&gt;
&lt;br /&gt;
'''s-pprzlink''' uses a formally verified cryptographic library [https://github.com/mitls/hacl-star HACL*] developed by the [http://prosecco.inria.fr/ Prosecco] team at [https://www.inria.fr/en/centre/paris INRIA Paris] in collaboration with Microsoft Research, as part of [https://github.com/project-everest Project Everest].&lt;br /&gt;
&lt;br /&gt;
Because certain data have to be send in plaintext (such as the message counter), '''s-pprzlink''' uses ''Authenticated Encryption with Associated Data'' (AEAD) algorithm to authenticate such data before use. Authentication means that any unauthorized change in data is detected upon decryption. Authentication is important because if we decide to send SENDER_ID or DESTINATION_ID in plaintext - so the receiver can decide whether to decrypt the message - we don't want it to be tampered with. '''s-pprzlink''' uses a modified [https://github.com/GaloisInc/gec Galois Embedded Crypto] algorithm, refer there for more details about the algorithm itself.&lt;br /&gt;
&lt;br /&gt;
The cryptographic overhead during regular communication is 20 bytes (4 bytes of the counter, 16 bytes of the authentication tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6|| sender ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|7|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|8..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23908</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23908"/>
		<updated>2017-11-04T02:29:12Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Pprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 16 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;  cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;text-align:center&amp;quot; cellpadding=&amp;quot;2%&amp;quot; width=&amp;quot;70%&amp;quot;&lt;br /&gt;
|+'''S-Pprzlink v1.0'''&lt;br /&gt;
!width=&amp;quot;7%&amp;quot;|''byte''!!width=&amp;quot;10%&amp;quot;|''Value''!!width=&amp;quot;10%&amp;quot;|''Type''&lt;br /&gt;
|-&lt;br /&gt;
|0||PPRZ_STX (0x99)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|1||length N (PPRZ_STX-&amp;gt;checksum B)||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|2||counter LSB 1 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|3||counter LSB 2 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|4||counter LSB 3 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|5||counter LSB 4 ||style=&amp;quot;background:green; color:white&amp;quot;|Authenticated data&lt;br /&gt;
|-&lt;br /&gt;
|6|| sender ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|7|| message ID ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|8..(N-16)|| (optional) message payload (0-234 bytes) ||style=&amp;quot;background:yellow; color:black&amp;quot;|Encrypted payload&lt;br /&gt;
|-&lt;br /&gt;
|(N-15)..(N-2)|| tag (16 bytes) ||style=&amp;quot;background:blue; color:white&amp;quot;|Authentication tag&lt;br /&gt;
|-&lt;br /&gt;
|N-1||checksum A||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|-&lt;br /&gt;
|N||checksum B||style=&amp;quot;background:orange; color:black&amp;quot;|Header&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23907</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23907"/>
		<updated>2017-11-04T02:17:59Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Pprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 16 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (16 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23906</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23906"/>
		<updated>2017-11-04T02:17:44Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Secure Paparazzi (S-PPRZ) for serial and transparent modem communication */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 16 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-16)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-15)..(N-2) TAG (12 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23868</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23868"/>
		<updated>2017-10-07T21:40:09Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Pprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:      |     value:&lt;br /&gt;
    0             PPRZ_STX (0x99)&lt;br /&gt;
    1             LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
    2-5           COUNTER (4 bytes)&lt;br /&gt;
    6             encrypted SENDER_ID&lt;br /&gt;
    7             encrypted MSG_ID&lt;br /&gt;
    8..(N-12)     encrypted MSG_PAYLOAD (messages.xml)&lt;br /&gt;
    (N-11)..(N-2) TAG (12 bytes)&lt;br /&gt;
    N-1           PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
    N             PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23867</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23867"/>
		<updated>2017-10-07T21:35:21Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Pprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
 byte:    |   value:&lt;br /&gt;
     0        PPRZ_STX (0x99)&lt;br /&gt;
     1        LENGTH (PPRZ_STX-&amp;gt;PPRZ_CHECKSUM_B)&lt;br /&gt;
     2        SENDER_ID&lt;br /&gt;
     3        MSG_ID&lt;br /&gt;
     4..(N-2) MSG_PAYLOAD (messages.xml)&lt;br /&gt;
     N-1      PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     N        PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0-3 COUNTER&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       4 SENDER_ID&lt;br /&gt;
       5 MSG_ID&lt;br /&gt;
       6 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       7-18 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23829</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23829"/>
		<updated>2017-09-05T03:32:49Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Pprzlink v2.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0-3 COUNTER&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       4 SENDER_ID&lt;br /&gt;
       5 MSG_ID&lt;br /&gt;
       6 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       7-18 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_ID&lt;br /&gt;
       8 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23828</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23828"/>
		<updated>2017-09-05T03:32:13Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* Pprzlink v2.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_ID&lt;br /&gt;
       4 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0-3 COUNTER&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       4 SENDER_ID&lt;br /&gt;
       5 MSG_ID&lt;br /&gt;
       6 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       7-18 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23827</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23827"/>
		<updated>2017-09-01T00:55:24Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: /* S-Ppprzlink v1.0 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v1.0===&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0-3 COUNTER&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       4 SENDER_ID&lt;br /&gt;
       5 MSG_ID&lt;br /&gt;
       6 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       7-18 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23826</id>
		<title>Messages Format</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Messages_Format&amp;diff=23826"/>
		<updated>2017-09-01T00:54:15Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;br /&gt;
&lt;br /&gt;
Messages Format and how to use them&lt;br /&gt;
&lt;br /&gt;
For the message definitions see http://docs.paparazziuav.org/latest/paparazzi_messages.html&lt;br /&gt;
&lt;br /&gt;
=Types=&lt;br /&gt;
&lt;br /&gt;
==Paparazzi &amp;quot;PPRZ&amp;quot; standard message for direct serial connection==    &lt;br /&gt;
&lt;br /&gt;
===Pprzlink v1.0===&lt;br /&gt;
&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===Pprzlink v2.0===&lt;br /&gt;
Note that there is currently no explicit way to recognize whether the protocol is v1.0 or 2.0 so it has to be known before the communication.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       3 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Secure Paparazzi (S-PPRZ) for serial and transparent modem communication==    &lt;br /&gt;
The overhead is 16 bytes (4 bytes of counter, 12 bytes of tag), plus the necessary key exchange at the beginning of communication.&lt;br /&gt;
&lt;br /&gt;
===S-Ppprzlink v1.0===&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0-3 COUNTER&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       4 SENDER_ID&lt;br /&gt;
       5 MSG_ID&lt;br /&gt;
       6 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       7-18 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
===S-Pprzlink v2.0===&lt;br /&gt;
In this case we decrypt only packets with matching DESTINATION (or broadcast), to avoid decrypting unwanted data.&lt;br /&gt;
 PPRZ-message: ABCxxxxxxxDE&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (A-&amp;gt;E)&lt;br /&gt;
     C PPRZ_DATA&lt;br /&gt;
       0 SOURCE (~sender_ID)&lt;br /&gt;
       1 DESTINATION (can be a broadcast ID)&lt;br /&gt;
       2-5 COUNTER (4 bytes)&lt;br /&gt;
       // ciphertext start&lt;br /&gt;
       6 CLASS/COMPONENT&lt;br /&gt;
         bits 0-3: 16 class ID available&lt;br /&gt;
         bits 4-7: 16 component ID available&lt;br /&gt;
       7 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
       // ciphertext end&lt;br /&gt;
       8-19 TAG (12 bytes)&lt;br /&gt;
     D PPRZ_CHECKSUM_A (sum[B-&amp;gt;C])&lt;br /&gt;
     E PPRZ_CHECKSUM_B (sum[ck_a])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==XBee API format==&lt;br /&gt;
&lt;br /&gt;
 XBee-message: ABCDxxxxxxxE&lt;br /&gt;
     A XBEE_START (0x7E)&lt;br /&gt;
     B LENGTH_MSB (D-&amp;gt;D)&lt;br /&gt;
     C LENGTH_LSB&lt;br /&gt;
     D XBEE_PAYLOAD&lt;br /&gt;
       0 XBEE_TX16 (0x01) / XBEE_RX16 (0x81)&lt;br /&gt;
       1 FRAME_ID (0)     / SRC_ID_MSB&lt;br /&gt;
       2 DEST_ID_MSB      / SRC_ID_LSB&lt;br /&gt;
       3 DEST_ID_LSB      / XBEE_RSSI&lt;br /&gt;
       4 TX16_OPTIONS (0) / RX16_OPTIONS&lt;br /&gt;
       5 PPRZ_DATA&lt;br /&gt;
         0 SENDER_ID&lt;br /&gt;
         1 MSG_ID&lt;br /&gt;
         2 MSG_PAYLOAD&lt;br /&gt;
         . DATA (messages.xml)&lt;br /&gt;
     E XBEE_CHECKSUM (sum[D-&amp;gt;D])&lt;br /&gt;
 &lt;br /&gt;
    ID is AC_ID for aircraft, 0x100 for ground station&lt;br /&gt;
&lt;br /&gt;
==Telemetry storage format for data logger==&lt;br /&gt;
&lt;br /&gt;
 TLM-message: ABCDEFGHxxxxxxxI&lt;br /&gt;
     A PPRZ_STX (0x99)&lt;br /&gt;
     B LENGTH (H-&amp;gt;H)&lt;br /&gt;
     C SOURCE (0=uart0, 1=uart1, 2=i2c0, ...)&lt;br /&gt;
     D TIMESTAMP_LSB (100 microsecond raster)&lt;br /&gt;
     E TIMESTAMP&lt;br /&gt;
     F TIMESTAMP&lt;br /&gt;
     G TIMESTAMP_MSB&lt;br /&gt;
     H PPRZ_DATA&lt;br /&gt;
       0 SENDER_ID&lt;br /&gt;
       1 MSG_ID&lt;br /&gt;
       2 MSG_PAYLOAD&lt;br /&gt;
       . DATA (messages.xml)&lt;br /&gt;
     I CHECKSUM (sum[B-&amp;gt;H])&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=23796</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=23796"/>
		<updated>2017-08-03T17:06:45Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input (provides position and orientation data, including GPS coordinates)&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
NOTE: If you want to use your own session, you have to pass ''-t hitl'' flag into ''sw/simulator/pprzsim-launch'' to start in HITL mode. Have a look at the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_control_panel.xml#L126 HITL USB-serual@57600] session for example, or add this to your own:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your control_panel.xml file&lt;br /&gt;
&amp;lt;session&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
     &amp;lt;program name=&amp;quot;Simulator&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-a&amp;quot; constant=&amp;quot;@AIRCRAFT&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-f&amp;quot; constant=&amp;quot;127.0.0.1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-b&amp;quot; constant=&amp;quot;127.255.255.255&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;--fg_fdm&amp;quot; constant=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;arg flag=&amp;quot;-t&amp;quot; constant=&amp;quot;hitl&amp;quot;/&amp;gt;&lt;br /&gt;
     &amp;lt;/program&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/session&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=23745</id>
		<title>HITL</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=HITL&amp;diff=23745"/>
		<updated>2017-07-19T16:00:21Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: updated HITL description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;categorytree style=&amp;quot;float:right; clear:right; margin-left:1ex; border: 1px solid gray; padding: 0.7ex;&amp;quot; mode=pages&amp;gt;Simulation&amp;lt;/categorytree&amp;gt;&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Hardware In The Loop Simulation=&lt;br /&gt;
&lt;br /&gt;
Hardware In The Loop (HITL) simulation is a way to test an embedded system (the real hardware and software) by simulating its environment, ie. sensor inputs, and comparing its output, ie. actuator outputs, to expected output values. It is the closest to an actual flight without actually flying. Using Paparazzi's [[Simulation|Software In The Loop]] (SITL) and HITL for validation of a flight dynamics of a fixed wing UAV is in detail described in a paper [http://digitalcommons.usu.edu/cgi/viewcontent.cgi?article=1109&amp;amp;context=mae_facpub &amp;quot;Software-and hardware-in-the-loop verification of flight dynamics model and flight control simulationof a fixed-wing unmanned aerial vehicle&amp;quot;] by Cal Coopmans and Michal Podhradsky. Refer to the paper for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Principle==&lt;br /&gt;
While the [[Simulation|SITL]] simulation executes the airborne code on the ground host, HITL is a way to run the autopilot code on the actual hardware in an environment where sensors and actuators are simulated. The difference is shown in diagrams below: SITL generates the physical behavior of the airplane from the Flight DynaMics (FDM) Block, then feeds the generated values into virtual sensors, the sensor inputs are processed in the autopilot and the autopilot control ouputs are captured and fed back into the FDM. HITL does the same, except it communicates with the autopilot over serial ports.&lt;br /&gt;
&lt;br /&gt;
In HITL, two separate processes are involved:&lt;br /&gt;
* The real autopilot code on the control board with its own IO (for example battery voltage, etc);&lt;br /&gt;
* A flight model combined with a model of the actuators and the sensors.&lt;br /&gt;
Commands computed by the autopilot are sent to the flight model which sends back simulated values of the sensors output.&lt;br /&gt;
&lt;br /&gt;
[[File:Sitl.png|550px|thumb|right|Software-in-the-loop (SITL) autopilot testing block diagram]]&lt;br /&gt;
[[File:Hitl.png|600px|thumb|right|Hardware-in-the-loop (HITL) autopilot testing block diagram]]&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
For practical reasons (it is very difficult to simulate SPI/I2C devices such as accelerometer, gyroscope etc.), Paparazzi HITL simulates only sensors that connect to the autopilot via serial port (for example GPS unit, or an external AHRS/INS). Currently implemented is [https://wiki.paparazziuav.org/wiki/Sensors/IMU#Vectornav_VN-200 Vectornav VN-200] in [[Subsystem/ins|INS]] mode, but other sensors and modes can be added (i.e. VN-200 as [[Subsystem/imu|IMU]], [[Sensors/IMU#Xsens_MTi_and_MTi-G_.28with_GPS.29|Xsens INS]] etc.). Because the benefit of HITL is to test the autopilot code that is identical to the actual flight code, no other means of transporting sensor data to the autopilot are currently supported (such as sending them through uplink). &lt;br /&gt;
&lt;br /&gt;
Another consideration is the bandwidth of the system - the sensor data and the actuator values have to be send/received at PERIODIC_FREQUENCY (between 40-512 Hz) for HITL to work correctly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==When to use SITL and when HITL?==&lt;br /&gt;
The  advantage  of  SITL  is  that  it  is  easy  to  deploy and test, because no additional hardware is needed. This means that simulation is very self-contained. Ideally use for testing flight plans, or initial tuning of airframes. SITL can run faster than real time.&lt;br /&gt;
&lt;br /&gt;
HITL is the simulation closest to real flight, because both the hardware and the code are identical to the set being used in real flight–the autopilot is really flying with artificial sensor data. HITL is used to test the flight hardware, once the flight plan and initial tuning has been configured. Usually HITL is the last thing to run before going flying.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
HITL can currently run on any [[Category:Autopilots|autopilot]] that has:&lt;br /&gt;
* Serial port for Vectornav INS input&lt;br /&gt;
* Serial port for additional high-speed telemetry output (so not your regular 57600 telemetry)&lt;br /&gt;
* other serial/io for regular telemetry, RC input etc.&lt;br /&gt;
&lt;br /&gt;
If you have high-speed telemetry (like over WiFi) it should be possible to use only one telemetry link and demux the messages on GCS, but it is not currently supported. Note that HITL is timig sensitive (at 512Hz you need to receive, process, and send data every ~2ms).&lt;br /&gt;
&lt;br /&gt;
HITL has been tested on:&lt;br /&gt;
* Lisa M/MX (exampes for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml fixedwing] and [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_ark_hexa_1-8.xml rotorcraft])&lt;br /&gt;
* Umarim v 2.0 (example for [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/El_Captain.xml fixedwing])&lt;br /&gt;
&lt;br /&gt;
We recommend a dedicated computer for HITL, with enough CPU power and memory, and a nice graphics card for [[FlightGear]] visualisation (see the test station in the picture). HITL can run on a regular laptop too (tested on both Lenovo Thinkpad and Toughbooks).&lt;br /&gt;
&lt;br /&gt;
[[File:HITL_station.jpg|600px|thumb|right|Hardware-in-the-loop (HITL) test station in simulated flight]]&lt;br /&gt;
&lt;br /&gt;
There are a few exaple airfames to choose from. Let's start with a fixed wing airplane and walk you through step by step. Get a [[Installation|fresh copy]] of the latest paparazzi and do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in prrz root dir&lt;br /&gt;
./start.py&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and choose AggieAir's conf and control panel:&lt;br /&gt;
&lt;br /&gt;
[[File:Aggieair conf.png|300px|frame|center|Select AggieAir's conf and control panel and then Launch]]&lt;br /&gt;
&lt;br /&gt;
Choose '''Minion_RP3''' airframe:&lt;br /&gt;
&lt;br /&gt;
[[File:Minion rp3 airfame.png|900px|thumb|center|Minion RP3 airfame]]&lt;br /&gt;
&lt;br /&gt;
and click on Edit. The airframe file is on github: https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml For HITL to work, there have to be 4 things:&lt;br /&gt;
&lt;br /&gt;
# [https://github.com/paparazzi/paparazzi/blob/master/conf/modules/extra_dl.xml extra_dl] telemetry module&lt;br /&gt;
# specified COMMANDS (Fixedwing) or ACTUATORS (rotorcrafts) Extra telemetry message in the telemetry config file (an example [https://github.com/paparazzi/paparazzi/blob/master/conf/telemetry/AGGIEAIR/aggieair_fixedwing.xml#L108 here]&lt;br /&gt;
# HITL target&lt;br /&gt;
# Airframe configured to use external INS&lt;br /&gt;
&lt;br /&gt;
=== Extra_DL module ===&lt;br /&gt;
This is the additiona high speed telemetry link that sends the actuators data back to the FDM.&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;!-- in order to use uart1 without chibios we need to remap the peripheral--&amp;gt;&lt;br /&gt;
      &amp;lt;define name=&amp;quot;REMAP_UART1&amp;quot; value=&amp;quot;TRUE&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;UART1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have [[Umarim_Lite_v2|Umarim]] board or similar, you can also use a usb serial port:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;extra_dl&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_PORT&amp;quot; value=&amp;quot;usb_serial&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;EXTRA_DL_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Telemetry config file ===&lt;br /&gt;
Just add this section to your telemetry config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your telemetry config file&lt;br /&gt;
  &amp;lt;process name=&amp;quot;Extra&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;mode name=&amp;quot;default&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;message name=&amp;quot;COMMANDS&amp;quot;            period=&amp;quot;0.01&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/mode&amp;gt;&lt;br /&gt;
  &amp;lt;/process&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The period has to be matching your '''PERIODIC_FREQUENCY''' - best if you explicitly define all the frequencies to avoid ambiguity:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;!-- NOTE: if you want to use extra_dl module for HITL&lt;br /&gt;
    you have to set TELEMETRY_FREQUENCY to CONTROL_FREQUENCY --&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;PERIODIC_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;CONTROL_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;configure name=&amp;quot;TELEMETRY_FREQUENCY&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;define name=&amp;quot;SERVO_HZ&amp;quot; value=&amp;quot;100&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: the '''TELEMETRY_FREQUENCY''' has to match your '''PERIODIC_FREQUENCY'''&lt;br /&gt;
&lt;br /&gt;
=== HITL target ===&lt;br /&gt;
Add the target in your airfame config file:&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;target name=&amp;quot;hitl&amp;quot; board=&amp;quot;pc&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;module name=&amp;quot;fdm&amp;quot; type=&amp;quot;jsbsim&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB1&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;INS_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_DEV&amp;quot; value=&amp;quot;/dev/ttyUSB2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;AP_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/target&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What does it mean? First, we have to specify the FDM for the HITL simulation. We recommend [[JSBSim]], but any FDM that [[NPS]] supports should work (because NPS is the backend for HITL).&lt;br /&gt;
&lt;br /&gt;
Then we have to specify the serial ports to talk to the autopilot. '''INS_DEV''' is the port your external [[Subsystem/ins|INS]] (such as Vectornav) is using. '''AP_DEV''' is the port for the extra telemetry. Make sure your baud rates are matching too.&lt;br /&gt;
&lt;br /&gt;
Note that you can either specify the devices in '''/dev/ttyUSB*''' format, which makes it universal across different USB-to-serial converters, but you have to remember to plug in the ports in the right order (since they enumerate sequentially). &lt;br /&gt;
&lt;br /&gt;
The other option is to specify the ''' /dev/serial/by-id/usb-FTDI_*****''' format, in which case it doesn't matter in which order you plug the devices in, but you can use it only for a particular FTDI converter. &lt;br /&gt;
&lt;br /&gt;
It might be handy to use a simple Lia breakout board for connecting all the serial ports - the breakout board files are available [https://github.com/paparazzi/paparazzi-hardware/tree/master/controller/lia/breakout_board here].&lt;br /&gt;
&lt;br /&gt;
[[File:Liabreakoutboard.jpeg|500px|thumb|center|Lia breakout board]]&lt;br /&gt;
&lt;br /&gt;
=== Airframe configuration for external INS ===&lt;br /&gt;
Indeed, HITL will work only if your aiframe is configured to use external INS of some sort. In our example, we specify using Vectornav:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
# in your airfame config file&lt;br /&gt;
    &amp;lt;module name=&amp;quot;ins&amp;quot;       type=&amp;quot;vectornav&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_PORT&amp;quot; value=&amp;quot;UART2&amp;quot;/&amp;gt;&lt;br /&gt;
      &amp;lt;configure name=&amp;quot;VN_BAUD&amp;quot; value=&amp;quot;B921600&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;/module&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [https://github.com/paparazzi/paparazzi/blob/master/conf/airframes/AGGIEAIR/aggieair_minion_rp3_lia.xml Minion_RP3 airframe config] for more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Running ==&lt;br /&gt;
Once you have your setup completed:&lt;br /&gt;
&lt;br /&gt;
# Clean, compile and upload the ''AP'' target (HINT: use keyboard shorcuts '''Alt+C''' to '''Clean''', '''Alt+B''' to '''Build''' and '''Alt+U''' to '''Upload''')&lt;br /&gt;
# Clean and build ''HITL'' target&lt;br /&gt;
# Choose '''HITL USB-serial@57600''' session and Execute&lt;br /&gt;
&lt;br /&gt;
Messages will pop up and you can verify that you are getting data by looking at the VECTORNAV_INFO message:&lt;br /&gt;
[[File:Hitl messages.png|thumb|center|VECTORNAV_INFO message]]&lt;br /&gt;
&lt;br /&gt;
And once you take-off you will see something like this:&lt;br /&gt;
[[File:Hitl flight.png|1000px|thumb|center|HITL Flight with fixedwing airplane]]&lt;br /&gt;
&lt;br /&gt;
Similar steps work for rotorcraft.&lt;br /&gt;
&lt;br /&gt;
=== SBUS fakerator ===&lt;br /&gt;
A simple tool simulating SBUS radio inputs is available. It is useful if you don't have a radio around, and want to test flight in manual mode. It has to be used with a [https://github.com/paparazzi/paparazzi/blob/master/conf/radios/AGGIEAIR/aggieair_sbus_fakerator.xml Sbus_fakerator radio config file] and it requires an additional serial port (for example ''/dev/ttyUSB3''). It can be launched as a tool from the Paparazzi center.&lt;br /&gt;
&lt;br /&gt;
Source code is available at: https://github.com/paparazzi/paparazzi/tree/master/sw/tools/sbus_fakerator&lt;br /&gt;
&lt;br /&gt;
[[File:Sbus fakerator.png|thumb|center|SBUS fakerator tool]]&lt;br /&gt;
&lt;br /&gt;
=== Flight Gear ===&lt;br /&gt;
We strongly recommned running HITL with [[FlightGear]] for visualisation. The steps are the same as when running [[NPS]] targets, please refer for documentation there.&lt;br /&gt;
&lt;br /&gt;
== Issues == &lt;br /&gt;
If you find a problem, please contact out gitter channel or file an issue on github ([https://github.com/paparazzi/paparazzi/issues here])&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;Happy flying!&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Simulation]] [[Category:Software]] [[Category:Hardware]] [[Category:Developer_Documentation]]&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Sbus_fakerator.png&amp;diff=23744</id>
		<title>File:Sbus fakerator.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Sbus_fakerator.png&amp;diff=23744"/>
		<updated>2017-07-19T15:53:58Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Hitl_flight.png&amp;diff=23743</id>
		<title>File:Hitl flight.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Hitl_flight.png&amp;diff=23743"/>
		<updated>2017-07-19T15:50:46Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Hitl_messages.png&amp;diff=23742</id>
		<title>File:Hitl messages.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Hitl_messages.png&amp;diff=23742"/>
		<updated>2017-07-19T15:47:58Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Liabreakoutboard.jpeg&amp;diff=23741</id>
		<title>File:Liabreakoutboard.jpeg</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Liabreakoutboard.jpeg&amp;diff=23741"/>
		<updated>2017-07-19T15:31:01Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Minion_rp3_airfame.png&amp;diff=23740</id>
		<title>File:Minion rp3 airfame.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Minion_rp3_airfame.png&amp;diff=23740"/>
		<updated>2017-07-19T15:01:50Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Aggieair_conf.png&amp;diff=23739</id>
		<title>File:Aggieair conf.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Aggieair_conf.png&amp;diff=23739"/>
		<updated>2017-07-19T14:59:00Z</updated>

		<summary type="html">&lt;p&gt;Podhrmic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Podhrmic</name></author>
	</entry>
</feed>