<?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=Camlee</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=Camlee"/>
	<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/wiki/Special:Contributions/Camlee"/>
	<updated>2026-05-19T13:54:50Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=15189</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=15189"/>
		<updated>2013-05-31T03:50:17Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This  goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to Use Redundant Links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to Use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px|thumb|center|The Agents Running in a Redundant Link Setup]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px|thumb|center|Screenshot of the GCS with multiple links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px|thumb|center|Paparazzi Ground Segment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px|thumb|center|Paparazzi Ground Segment with Redundant Links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px|thumb|center|Algorithm to prevent duplicate messages]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tools]]&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Software_Wish_List&amp;diff=14984</id>
		<title>Software Wish List</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Software_Wish_List&amp;diff=14984"/>
		<updated>2013-04-29T02:22:06Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Added link to an existing solution to a wish list item&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|&lt;br /&gt;
|-valign=&amp;quot;top&amp;quot;&lt;br /&gt;
|__TOC__&lt;br /&gt;
|Please use the [[Talk:Software_Wish_List|Discussion]] tab at the top of the page, as appropriate.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''This page is only kept for reference!'''&lt;br /&gt;
&lt;br /&gt;
'''Please use our [https://github.com/paparazzi/paparazzi/issues issue tracker] for reporting bugs, requesting new features or to list things currently in progress (or planned).'''&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
After you played around with the GCS, the Airborne code, tested it and used all it's possibilities, sometimes you get this feeling... &amp;quot;''I would like to have '''more'''!''&amp;quot;. The first thing to do is to ask in the mailinglist if it is already possible. The next great thing would be to create what you think is lacking and give it back to the community so it could be part of the project in the future. If you are not that gifted yet, you could present your ideas here. Other enthusiastic Paparazzi developers could read this and think: &amp;quot;''YEAH, now that is a really cool idea and I will start working on it right away!''&amp;quot;. Therefore, since everyone can improve a part of the project, note here what you would like to see added or improved in the software.&lt;br /&gt;
&lt;br /&gt;
== Ground Station Suggestions ==&lt;br /&gt;
&lt;br /&gt;
# Module to make papazzi messages available in QGroundControl http://qgroundcontrol.org/ [[User:OpenUAS|(Suggested by OpenUAS)]]&lt;br /&gt;
# Integration with module for OpenJAUS, see for already available code http://code.google.com/p/openjaus/ [[User:OpenUAS|(Suggested by OpenUAS)]]&lt;br /&gt;
# Support for stanag 4586 compliance, see http://www.innuvativesystems.com/stanag_4586_primer.html [[User:OpenUAS|(Suggested by OpenUAS)]]&lt;br /&gt;
# Support for standard map files like GeoTiff, .tab and .map. Using the .xml method manually is rather time consuming and frustrating when you already have standard georeferenced images.&lt;br /&gt;
# Divide the flight plan into 3 separate files [[User:Jeremy|(Suggested by Jeremy)]]&lt;br /&gt;
#* Takeoff/Landing - flight plan blocks describing the complex routines and using altitudes and waypoints from the ''User'' file&lt;br /&gt;
#* Generic - a file that users should never need to edit, containing circles, rectangles, figure-8's, and surveys that appear on command when GCS buttons are pressed.  Altitude/locations could be relative to the ''User'' file&lt;br /&gt;
#* User - Here we can specify fixed or dynamic ''Home'' point and add complex routines or simply save certain basic routines. &lt;br /&gt;
#*('''NOTE:''' All of this is already possible, investigate time in discovering what paparazzi already can do now e.g. see [http://paparazzi.enac.fr/wiki/Flight_Plans#Procedures Flight Plan Procedures])&lt;br /&gt;
# The possibility to use multiple ground modem connected to a single ground station. The RSSI could be use to dynamically choose which currently has the best signal. This would allow the use of different antennas on each of the modems or have antenna pointing in different directions(?Possibly more hardware related) - Something similar, but with more flexibility, has been created. See [http://paparazzi.enac.fr/wiki/Redundant_Communication Redundant_Communication].&lt;br /&gt;
# PFD - the horizon and the sky shouldn't move only the main line. Because we are on the '''ground''' and we really need to see the roll angle of the UAS and not the real PFD like on a real airplane. And we could also see, the pitch angle, to see if the UAS is climbing or going down. Another way this could be done is to use a 3D model of the plane like procerus does on there ap. For those unfamiliar with this it is like you are in the view point of like 5m behind the plane. This might give the user just enough of a model to help fly back under manual control or at least have a better understanding of the orientation. This idea is good one but it should not replace the current pfd but rather be an option to use in the gcs. ('''NOTE:''' Already possible, via [http://paparazzi.enac.fr/wiki/GCS#Papgets Papgets] it is possible to add all kinds of such types of information. Also for a 3D plane view this is already possible, just bind you output to [http://paparazzi.enac.fr/wiki/Simulation#View_the_simulation_in_Flight_Gear FlightGear])&lt;br /&gt;
# Language packs for the GCS - English, French, German, Italian, Spanish, Portuguese, ... (azoreanuav(at)gmail.comI would like to make the portuguese pack, but I neet help how to do it.)&lt;br /&gt;
# Flashing via modems - ('''NOTE:''' Already [http://lists.gnu.org/archive/html/paparazzi-devel/2010-06/msg00138.html possible])&lt;br /&gt;
&lt;br /&gt;
== Airborne Software Suggestions ==&lt;br /&gt;
&lt;br /&gt;
Add your ideas here what you would like to see added or improved in the airborne software&lt;br /&gt;
&lt;br /&gt;
=== Stability ===&lt;br /&gt;
* Auto-tuning of gains&lt;br /&gt;
*: It would make paparazzi very user friendly if the airframe could tune itself. It should be possible to set the gains on the ground to some generic value and let the autopilot do the tuning in the air. The autopilot would give step functions on different inputs (actuators, target values) and measure the response of the airframe. One at a time, of course. Based on this response measurement the autopilot can tune the control gains itself. For safety reasons this auto-tuning function would run only on safe flight altitude.&lt;br /&gt;
&lt;br /&gt;
=== Navigation ===&lt;br /&gt;
* Flight plan stage sensing &lt;br /&gt;
*: Carrot should continue past the waypoint toward the next point, but the point should not be officially acknowledged until the plane has passed it.  This way we can have smooth, intelligent navigation while still considering waypoint triggers such as still-photo, sensor drop, or throttle off. &lt;br /&gt;
'''NOTE:''' Can already be done by setting the approaching_time attribute. This value helps to decide when the target is reached. It can be set to 0 to go over the target waypoint. see [http://paparazzi.enac.fr/wiki/Flight_Plans#Go Flightplan documentation]&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
# '''Revised autopilot modes''' [[User:Jeremy|(Jeremy)]]&lt;br /&gt;
#* I propose a restructuring of the modes as follows - create 3 top-level modes: '''Man, Stab,'''and '''Auto''', each with an appended autonomous sub-mode (i.e. '''Man'''/''Climb'', '''Stab'''/''Kill'', '''Auto'''/''Landing'', etc.)  This will give the operator much more information and a much better indication of what the plane will do when switched to autonomous mode in a concise manner.  Furthermore, I see an advantage in having simple behaviors like ''Climb, Landing'', etc. be defined as sub-modes so that operator is always alerted of changes such as ''Descent'' or can easily configure trim, gains, and payload options in the airframe file (i.e. if mode = ''Landing'' then retract camera, turn off video system, use landing trim, etc.)&lt;br /&gt;
#* ''Sub-modes''&lt;br /&gt;
#* ''Ground'' - The default boot mode.  In this mode the throttle is locked at 0% or not armed at all (no PWM signal), stability is disabled (servos locked in neutral position), and video power is off, but flight plan blocks are processed.  This will improve safety and aid in lost plane retreival as the servos, and video will not drain the battery if landing detection is implemented.  ''Ground'' mode should exit '''only''' if ''Takeoff'' is manually triggered.&lt;br /&gt;
#* ''Takeoff'' - 3 possible triggers: GCS button, GPIO button, or R/C throttle.  Checks for error modes and desired climb, then arms/unlocks throttle, initates &amp;quot;Takeoff&amp;quot; flight plan block, and instantly deroutes to ''Climb'' mode.  Deroutes to ''Descent'' mode without unlocking throttle if not OK.  ''Takeoff'' could simply be a flag rather than a &amp;quot;mode&amp;quot;.&lt;br /&gt;
#* ''Climb'' - Triggered anytime &amp;quot;aggressive climb&amp;quot; is active&lt;br /&gt;
#* ''Descent'' - Triggered anytime &amp;quot;aggressive descent&amp;quot; is active&lt;br /&gt;
#* ''Nav'' - Normal level flight&lt;br /&gt;
#* ''Landing'' - Same as ''Nav'' but using the &amp;quot;Landing&amp;quot; flight plan block and any airframe gains/trims/payload options as defined in airframe.xml&lt;br /&gt;
#* ''Kill'' - Triggered manually - locks throttle at 0% and uses pitch/roll settings from Airframe.xml.  &lt;br /&gt;
# ''Error sub-modes''&lt;br /&gt;
#* ''No GPS'' - A temporary mode using pitch/roll settings from airframe.xml&lt;br /&gt;
#* ''Home'' - Triggered by distance in '''Auto''' mode or by distance/RC loss in '''Stab''' mode (after ''n'' seconds, as defined in airframe.xml).  Exits upon manual block/mode change requests from the GCS and cannot be re-initiated for 30 seconds.&lt;br /&gt;
# '''Continually broadcast last known location'''&lt;br /&gt;
#* AP should continue to broadcast the last known GPS coordinate in the event of GPS loss. (i.e. upside-down crashed plane should continue to send last known position in case it was out of data range prior to the crash.)&lt;br /&gt;
#* ('''NOTE:''' Possible by adding for example a module that ''grabs'' current coordinates at e.g. .1 Hz and if in flightplan &amp;lt;while cond=&amp;quot;!GpsFixValid()&amp;quot;/&amp;gt; send whatever you want)&lt;br /&gt;
# '''Ability to upload waypoints in flight'''&lt;br /&gt;
#* I know this has been discussed a few times but it would be nice to at least have the option to upload waypoints and blocks and be able to change blocks in flight. This is risky but most Autopilot's do have this feature now and it would be nice if the user could make this decision. &lt;br /&gt;
#* ('''NOTE:''' A possible current solution is by adding duplicate waypoints very close and if needed move these while in flight.)&lt;br /&gt;
# '''Radio Control of UAS through Data Link'''&lt;br /&gt;
#* This simply means that instead of hacking an RC receiver to output it to the autopilot board why not hook your RC transmitter up through your computer and use the data link for RC. This would be nice especially with all the new RC range issues the 2 layer tiny 2.11 has brought on. Also it would be nice because RC interference would be eliminated. Please comment on this and tell me what you think&lt;br /&gt;
#* ('''NOTE:''' Already possible)&lt;br /&gt;
#* ('''Response:''' Sort of possible. The only work that has been done in this direction is by Martin and was done with a Joystick which only worked in Auto1 mode (setting the set points for the AP). This is not a full solution. What i am proposing is that the RC Radio is plugged into the GCS directly and then sends the command (PPM) signals directly to the AP. This would allow for the user to control the aircraft in manual and AUTO1. Consult any commercial AP and you will notice that this is the one glaring feature which is missing from PPRZ. In addition adding this feature would allow for longer range FPV flying. Please correct me (with links) if i am wrong. &lt;br /&gt;
&lt;br /&gt;
# '''Precision Surveying'''&lt;br /&gt;
#* It would be nice to have a survey function that could survey a sector and also be told what coordinates to begin the survey on. Another useful feature would be to have the plane sense when it is done surveying the whole area so it could move to the next block. I know that the entering the survey can be done in a roundabout method by defining a waypoint at the entry point and then going to it but defining it in the survey function would allow for more precise survey since that first sweep would already be defined and then would not be affected by if the plane went into the survey function at weird spot or something.&lt;br /&gt;
#* ('''NOTE:''' Already possible, see the [http://paparazzi.enac.fr/wiki/Advanced_Navigation_Routines '''Polygon Survey'''] and use it smartly&lt;br /&gt;
&lt;br /&gt;
== Current Code and Build ==&lt;br /&gt;
&lt;br /&gt;
If you have any suggestions to improve the current:&lt;br /&gt;
&lt;br /&gt;
* Sourcecode&lt;br /&gt;
* Build process&lt;br /&gt;
* Code repository&lt;br /&gt;
* Tools used&lt;br /&gt;
&lt;br /&gt;
...give your suggestions here. Better still, start working on what you can, and add your information to the Wiki and start a discussion in the mailing list.&lt;br /&gt;
&lt;br /&gt;
== JAUS Support ==&lt;br /&gt;
&lt;br /&gt;
The Joint Architecture for Unmanned Systems (JAUS) is the premiere interoperability standard for unmanned systems. This standard originated in the Joint Robotics Program, a U. S. Department of Defense Office in 1998 and since has migrated to an open, commercial standard. JAUS has been adopted by the Society of Automotive Engineers, Aerospace Standards Division. Use of the standard is required in major Department of Defense programs and it is used in a variety of commercial and industrial applications worldwide.&lt;br /&gt;
&lt;br /&gt;
It would be good to investigate how we could add a compatibility layer.&lt;br /&gt;
&lt;br /&gt;
== X-plane HITL Support ==&lt;br /&gt;
&lt;br /&gt;
For an example las on&lt;br /&gt;
http://code.google.com/p/gentlenav/wiki/HardwareInLoop&lt;br /&gt;
&lt;br /&gt;
Hector: I used X-Plane in the past for HITL porposes. You have to be carefull as I have not read the next in anywhere.&lt;br /&gt;
&lt;br /&gt;
As far as I know, simulation time step is not fixed in X-Plane and it depends on&lt;br /&gt;
your fps. If you are performing navigation and control algorithms with a time-step fixed, this issue can ruin the behaviour of your avionics.&lt;br /&gt;
&lt;br /&gt;
I was talking in the IRC with experienced users in X-Plane, and they have written a pluggin to setup the time-stamp (or limiting the fps, X-Plane does not do that by default, only to monitor refreshment), and it does not work as expected always. Also X-Plane physics introduces &amp;quot;artifacts&amp;quot; sometimes ruining your inertial measurements.&lt;br /&gt;
&lt;br /&gt;
Resuming, X-Plane (commercial version) is not aimed for HITL, for this question, they have the FAA certified version (more expensive of course :P).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Software]]&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14983</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14983"/>
		<updated>2013-04-29T02:07:15Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to Use Redundant Links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to Use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px|thumb|center|The Agents Running in a Redundant Link Setup]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px|thumb|center|Screenshot of the GCS with multiple links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px|thumb|center|Paparazzi Ground Segment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px|thumb|center|Paparazzi Ground Segment with Redundant Links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px|thumb|center|Algorithm to prevent duplicate messages]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tools]]&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14982</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14982"/>
		<updated>2013-04-28T05:33:42Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px|thumb|center|The Agents Running in a Redundant Link Setup]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px|thumb|center|Screenshot of the GCS with multiple links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px|thumb|center|Paparazzi Ground Segment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px|thumb|center|Paparazzi Ground Segment with Redundant Links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px|thumb|center|Algorithm to prevent duplicate messages]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tools]]&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14981</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14981"/>
		<updated>2013-04-28T05:31:20Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px|thumb|center|The Agents Running in a Redundant Link Setup]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px|thumb|center|Screenshot of the GCS with multiple links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px|thumb|center|Paparazzi Ground Segment]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px|thumb|center|Paparazzi Ground Segment with Redundant Links]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px|thumb|center|Algorithm to prevent duplicate messages]]&lt;br /&gt;
&amp;lt;br style=&amp;quot;clear:both&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14980</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14980"/>
		<updated>2013-04-28T05:25:18Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px|The Agents Running in a Redundant Link Setup]]&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px|Paparazzi Ground Segment]]&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px|Paparazzi Ground Segment with Redundant Links]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px|Algorithm to prevent duplicate messages]]&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14979</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14979"/>
		<updated>2013-04-28T05:22:23Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px]]&lt;br /&gt;
&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|800px]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|500px]]&lt;br /&gt;
&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14978</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14978"/>
		<updated>2013-04-28T05:20:33Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|700px]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|500px]]&lt;br /&gt;
&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|1000px]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|300px]]&lt;br /&gt;
&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14977</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14977"/>
		<updated>2013-04-28T05:18:55Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|1000px]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|1000px]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|1000px]]&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|1000px]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|1000px]]&lt;br /&gt;
&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14976</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14976"/>
		<updated>2013-04-28T05:14:42Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|upright=0.2]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|upright=0.1]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|upright=0.1]]&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|upright=0.1]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|upright=0.1]]&lt;br /&gt;
&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14975</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14975"/>
		<updated>2013-04-28T05:13:37Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session|upright=0.5]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used|upright=0.25]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment|upright=0.25]]&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used|upright=0.25]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner|upright=0.25]]&lt;br /&gt;
&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Link_combiner_flowchart.png&amp;diff=14974</id>
		<title>File:Link combiner flowchart.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Link_combiner_flowchart.png&amp;diff=14974"/>
		<updated>2013-04-28T05:07:21Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Algorithm used by the Link Combiner to combine messages when using multiple links.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Algorithm used by the Link Combiner to combine messages when using multiple links.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_links_block_diagram.png&amp;diff=14973</id>
		<title>File:Redundant links block diagram.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_links_block_diagram.png&amp;diff=14973"/>
		<updated>2013-04-28T05:06:14Z</updated>

		<summary type="html">&lt;p&gt;Camlee: uploaded a new version of &amp;quot;File:Redundant links block diagram.png&amp;quot;:&amp;amp;#32;Block diagram of the redundant link system.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_links_block_diagram.png&amp;diff=14972</id>
		<title>File:Redundant links block diagram.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_links_block_diagram.png&amp;diff=14972"/>
		<updated>2013-04-28T05:05:28Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Ground_segment_block_diagram.png&amp;diff=14971</id>
		<title>File:Ground segment block diagram.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Ground_segment_block_diagram.png&amp;diff=14971"/>
		<updated>2013-04-28T05:04:41Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_link_gcs.png&amp;diff=14970</id>
		<title>File:Redundant link gcs.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_link_gcs.png&amp;diff=14970"/>
		<updated>2013-04-28T05:03:27Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Screenshot of the GCS with multiple, redundant links running.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of the GCS with multiple, redundant links running.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_session.png&amp;diff=14969</id>
		<title>File:Redundant session.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Redundant_session.png&amp;diff=14969"/>
		<updated>2013-04-28T05:02:21Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Agents running the Paparazzi Center when using redundant links.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Agents running the Paparazzi Center when using redundant links.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14968</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14968"/>
		<updated>2013-04-28T05:00:50Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|center|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_session.png|alt=Agents in Redundant Link Session]]&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
[[File:redundant_link_gcs.png|alt=Changes to the GCS when redundant links are used]]&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:ground_segment_block_diagram.png|alt=Block diagram of agents in the ground segment]]&lt;br /&gt;
Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
[[File:redundant_links_block_diagram.png|alt=Block diagram of agents in the ground segment when redundant links are used]]&lt;br /&gt;
Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
[[File:link_combiner_flowchart.png|alt=Flowchart of the Link Combiner]]&lt;br /&gt;
Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=File:Link_page.png&amp;diff=14967</id>
		<title>File:Link page.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=File:Link_page.png&amp;diff=14967"/>
		<updated>2013-04-28T04:53:18Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Multiple links appear in the link page of the GCS when using redundant links.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Multiple links appear in the link page of the GCS when using redundant links.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14966</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14966"/>
		<updated>2013-04-28T04:52:10Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;div style=&amp;quot;float: right; width: 15%&amp;quot;&amp;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;Tools&amp;lt;/categorytree&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 45%; overflow: hidden&amp;quot;&amp;gt;[[Image:link_page.png|right|397px|Link Page in GCS]]&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; width: 40%&amp;quot;&amp;gt;__TOC__&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to redundant links===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://2.bp.blogspot.com/-4ytdpqXMHa0/UXMlR-qGkbI/AAAAAAAAEZw/JO959QjWip4/s640/Screenshot+from+2013-04-15+23_02_27.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14965</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14965"/>
		<updated>2013-04-28T04:38:27Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: fly to a waypoint, start the search area, come in for a landing. If a single link is used, as was always the case before this project, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be received by the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information could easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - also, you can use redundant links for one aircraft, but not for another if desired.&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft.&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS.&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link).&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy future needs that may arise:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s.&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough (say within 2 seconds - this could be configured)&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate. Or if the timestamp improvement is implemented, then the maximum time difference could be adjusted.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the '''Flight USB-serial Redundant''' session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot's UART port to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever). (note: Once the ground to aircraft redundancy has been implemented, you won't have to split the Rx signal and can just plug each modem into a UART port)&lt;br /&gt;
* Launch a Link agent for each modem (in Paparazzi Center, select it from the tools menu). Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent (again, from the tools menu). This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://2.bp.blogspot.com/-4ytdpqXMHa0/UXMlR-qGkbI/AAAAAAAAEZw/JO959QjWip4/s640/Screenshot+from+2013-04-15+23_02_27.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, make sure that the buffer size if appropriate. Take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section for details.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station.&lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see the new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode: -redlink), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent to the other agents. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various messages, possibly with the exact same data, and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND one or more links were lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not particularly familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots.&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for the counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14964</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14964"/>
		<updated>2013-04-28T03:15:10Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the aircraft to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to aircraft component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the aircraft goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy everybody's needs:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the aircraft (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough.&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section to ensure that the correct buffer size of chosen.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the aircraft talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the aircraft to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the aircraft sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the aircraft actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the aircraft to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the aircraft sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not that familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the aircraft. This would allow the autopilot to easily ignore identical messages - they'll have the same value for counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14963</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14963"/>
		<updated>2013-04-28T03:12:32Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429 github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy everybody's needs:&lt;br /&gt;
* Additional information can easily be added to the Link page of the GCS for each link. For example: errors, % uptime, or a scrolling graph of Rx messages/s&lt;br /&gt;
* The ability to mark different links as either critical or backup. The idea here is that not all links should necessarily be treated equal. Maybe only one link is able to send datalink data to the plane (actually, this is the case right now) and so that link should be considered critical. If any other link is lost, then the overall telemetry can be counted as OK. But if the critical link is lost, then the GCS should change the link indicator light to red and start counting up even if the other link(s) are OK.&lt;br /&gt;
* The Link Combiner algorithm currently employs a simple circular buffer. This could be improved on by adding a time-stamp to each element of the buffer and only counting two buffer elements to be the same if their timestamps are close enough.&lt;br /&gt;
* The Link Combiner algorithm could be improved by making the buffer size adjust automatically with the ping time and Rx messages/s rate.&lt;br /&gt;
* A performance and resource use analysis could be done to optimize the Link Combiner. The circular buffer is currently implemented using Python lists which could probably be improved upon. Also, significantly more ivy messages are sent and received. This might make optimizations to the regex or other parts of the ivybus worthwhile.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section to ensure that the correct buffer size of chosen.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the plane talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the plane to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the plane sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the plane actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the plane to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the plane sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not that familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the plane. This would allow the autopilot to easily ignore identical messages - they'll have the same value for counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14962</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14962"/>
		<updated>2013-04-28T02:43:20Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy everybody's needs:&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section to ensure that the correct buffer size of chosen.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
====Implementation====&lt;br /&gt;
Here's a block diagram showing how the plane talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the plane to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the plane sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the plane actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the plane to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the plane sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, it is believed that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, would it be advantageous to have multiple instances be supported for each different subsystem? Once the design for this is determined, would actual support for each subsystem have to be added one at a time? Because of the logic for how multiple subsystems should behave together is dependent on the subsystem, this might be the case. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not that familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, the author proposes a system that adds a counter to each message sent to the plane. This would allow the autopilot to easily ignore identical messages - they'll have the same value for counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14961</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14961"/>
		<updated>2013-04-28T02:35:28Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested in the lab. More comprehensive testing should be performed before the system is considered to be stable. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===Future Improvements===&lt;br /&gt;
Several different improvements can be made to this system to improve it's performance and help satisfy everybody's needs:&lt;br /&gt;
* &lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section to ensure that the correct buffer size of chosen.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Here's a block diagram showing how the plane talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the plane to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the plane sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the plane actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the plane to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the plane sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, I believe that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;br /&gt;
&lt;br /&gt;
This part of the redundant communication system hasn't been implemented yet. All information here is what it is envisioned to look like.&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
* Enable multiple datalink links to be used for communicating with the autopilot.&lt;br /&gt;
* Let different telemetry be sent out each link.&lt;br /&gt;
* Let the choice of what telemetry is sent be moved from the settings page of the GCS to the Link page, since it can be different for each link.&lt;br /&gt;
* Add a link status indicator (this is the light that turns red when the link is lost) for the datalink to the Link page. This will allow better monitoring of the links by not assuming that if one direction is good, the other direction is good as well.&lt;br /&gt;
* Let each link be configured as telemetry only, datalink only, or by-directional.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
Communication in the autopilot is enabled with the ground by including the telemetry subsystem in the airframe file. For example:&lt;br /&gt;
{{Box Code|conf/airframes/myplane.xml|&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;firmware name=&amp;quot;fixedwing or rotorcraft&amp;quot;&amp;gt;&lt;br /&gt;
     ...&lt;br /&gt;
    &amp;lt;subsystem name=&amp;quot;telemetry&amp;quot;     type=&amp;quot;transparent&amp;quot;/&amp;gt;&lt;br /&gt;
  &amp;lt;/firmware&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
In order to use multiple links, changes should be made to allow a telemetry subsystem for each link. Related to this, I've heard that it would be advantageous multiple instances of each subsystem to be included. I would imaging that once the design for this is determined, actual support for each subsystem would have to be added one at a time. This is because the logic for how multiple subsystems should behave together is dependent on the subsystem. The telemetry subsystem for example should default to sending telemetry out each one and combining the telemetry received.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Hardware===&lt;br /&gt;
Unlike aircraft to ground redundancy, ground to aircraft redundancy requires multiple UART ports in the hardware of the autopilot. The author is not that familiar with this, but believes that there are ways to get multiple UART ports for this purpose:&lt;br /&gt;
* Telemetry can be sent out over USB by specifying the telemetry type to be &amp;quot;transparent_usb&amp;quot;.&lt;br /&gt;
* For the Lisa/M, the USB port can actually be used as a UART port with some hardware modifications.&lt;br /&gt;
* Using an I2C GPS instead of a UART one can free up a UART port on most autopilots&lt;br /&gt;
* For the Lisa/M, can UART 1 and 5 be used if Spektrum Satellite receivers aren't used? If so, where are the Tx pins?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In addition, future hardware designs could includes more UART ports for redundant communications or any other purpose.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Unlike the aircraft to ground communication, for ground to aircraft communication it is not acceptable to have the same message be acted on twice. This could cause the aircraft to behave unexpectedly. In order to implement a 100% guaranteed link combiner for the aircraft, I propose a system that adds a counter to each message sent to the plane. This would allow the autopilot to easily ignore identical messages - they'll have the same value for counter. Also, since minimal data is sent from the ground to the aircraft, adding the extra bytes to the payload will have a minimal impact on performance - this is not the case for the telemetry.&lt;br /&gt;
&lt;br /&gt;
The challenging part of this design will be integrating it properly into the existing systems.&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14960</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14960"/>
		<updated>2013-04-28T00:45:39Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
* Test the system and make sure that it works correctly under all circumstances. Do this before flying. In particular, take a look at the [[#Algorithm Considerations|Algorithm Considerations]] section to ensure that the correct buffer size of chosen.&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Here's a block diagram showing how the plane talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the plane to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the plane sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the plane actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the plane to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
====Algorithm Considerations====&lt;br /&gt;
As the plane sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, I believe that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14959</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14959"/>
		<updated>2013-04-28T00:40:23Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
===Interface===&lt;br /&gt;
Once the redundant link system is started (even if only one Link is used), several changes appear in the GCS. This is achieved by the new message LINK_STATUS which is sent by the Link Combiner. These new features are designed to allow closer monitoring and better management of the link(s) between the aircraft and the ground station. &lt;br /&gt;
&lt;br /&gt;
The following screenshot clearly shows these changes:&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Firstly, we can see that there is a new page in the notebook named Link. This page contains critical information for each link. More information can easily be added, but for now, it shows the status of the link (just like the main Link status indicator in the strip), the current ping time, and the rate of received messages. So if one link is lost, it's status indicator will turn red and start counting up just like link 2 in the above screenshot.&lt;br /&gt;
&lt;br /&gt;
Next, we can see that the main Link status indicator that's located in the strip has been modified slightly. It now shows the ratio of connected links to the total number of links. I.e. 3/4 means that there are four links and one of them has been lost. Furthermore, the indicator will be green if all links are connected, yellow if one or more are lost, and red if all links are lost. Once all links are lost, the indicator will count up just like before.&lt;br /&gt;
&lt;br /&gt;
Lastly, alerts have been added to the console. Whenever a link is lost or reconnected, a message will appear in the console stating so. Messages also appear when a new link is added.&lt;br /&gt;
&lt;br /&gt;
===Design===&lt;br /&gt;
Here's a block diagram showing how the plane talks to the various ground segment programs (also known as agents) when not using the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-8-YENO6LcNs/UXMRpkJlx1I/AAAAAAAAEZQ/Z3XDrJCRzQs/s400/Normal+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment&lt;br /&gt;
&lt;br /&gt;
The ivy bus lets the programs talk to each other through the use of short messages. Pay close attention to the coloured arrows, which show the main flow of these messages. Next we have a block diagram of the redundant link system:&lt;br /&gt;
&lt;br /&gt;
http://4.bp.blogspot.com/-nx_p90B7FU4/UXMddbJ_gEI/AAAAAAAAEZg/qnbrS-bS3l0/s640/Redundant+Communication+Layout.png&lt;br /&gt;
Caption: Paparazzi Ground Segment with Redundant Links&lt;br /&gt;
&lt;br /&gt;
Here we can see a new agent, the Link Combiner. We also see multiple occurrences of the Link agent. When operating in redundant mode, each occurrence of Link transmits the data it receives from the plane to the Link Combiner instead of the Server. It does this by transmitting the received telemetry messages within the TELEMETRY_MESSAGE message which the Server doesn't listen to. The Link Combiner on the other hand does. TELEMETRY_MESSAGE messages are sent by each link and include the id of that link. The Link Combiner listens to all of them and then transmits a single set of messages to the Server with the combined data. This results in the Server and all other ground segment agents (such as Messages and the Real Time Plotter) getting their telemetry data from Link Combiner as if it was coming from a single occurrence of Link.&lt;br /&gt;
&lt;br /&gt;
====Link Combiner====&lt;br /&gt;
The Link Combiner agent is written in Python. It receives messages from all of the Links (when they're in redundant mode), and outputs messages to the Server and other ground segment agents. There is a bit involved however since the Server and GCS shouldn't be sent identical messages. I.e. if the plane sends a message and it's received successfully by more than one link, then that particular message should only sent by Link Combiner once. This is a somewhat tricky requirement since there is no guarantee that the message will be received by all of the links, and it's possible that the plane actually sends a second message that's exactly the same as the first. No extra info (such as a time-stamp or counter) is added to the messages sent from the plane to the ground, so the Link Combiner employs an algorithm to detect duplicate messages. Testing has shown that for typical links, this algorithm performs extremely well.&lt;br /&gt;
&lt;br /&gt;
The algorithm gives each link a circular buffer to store the last N messages. When a new message comes in on a particular link, the algorithm first checks if it's already in that link's buffer. If it is, then it's obviously a new message, so its removed from all of the other buffers if it's in any of them. Then, the message is sent. If the message isn't already in the link's buffer, then it's added to the buffer. After that, all of the other link's buffers are checked for the message. If it's in any of them, then the message was already received by another link, so isn't sent. If it's not in any of them, then the message is sent. The following flowchart depicts this algorithm:&lt;br /&gt;
&lt;br /&gt;
http://1.bp.blogspot.com/-G1LYSsliAiY/UXNBjHj93PI/AAAAAAAAEaI/hom9cRmd3jI/s640/Algorithm+Diagram.png&lt;br /&gt;
Caption: Algorithm to prevent duplicate messages&lt;br /&gt;
&lt;br /&gt;
As the plane sends various, possibly identical, messages and the links gain and lose connection, there is no guarantee that this algorithm will do a perfect job of filtering out identical and only identical messages. However, in typical operation, it seems to work very well. And for the application of displaying aircraft data, the occasional missing or duplicate message is acceptable. There are only a few scenarios where the Link Combiner won't produce perfect results, and they should come up infrequently:&lt;br /&gt;
&lt;br /&gt;
* A message will be sent twice if the buffer size is too small to hold all of the messages received from one link between that link receiving the message and another link receiving the identical message. When the second link receives the message that has already been received, if the original isn't in the buffer anymore, than the algorithm won't know it's a duplicate message. This scenario should be considered whenever implementing a redundant link system. Partly because it is the most likely to come up, but also because if it does occur, then all messages will be duplicated. In order to avoid this scenario, you can set the buffer size as a command line argument of Link Combiner. To know what a good value would be, you can observer the Ping time and Rx messages/s of the links in the new Link page of the notebook. Calculate the minimum buffer size by taking the difference between the largest ping time and the smallest ping time and multiplying it by the largest Rx messages/s. Then apply a safety factor when setting the buffer size - 10 times the calculated value should be good.&lt;br /&gt;
* A message won't be sent when it should be if the autopilot sends a message that's the same as one it already sent (same name and exact same values) AND at least one link was lost between the first message and the second AND the link that's receiving the second message doesn't have the first message in it's buffer still. That's three conditions. If this happens, then the Link Combiner will see the second message as a duplicate of the first and will skip it. Only this one message will be missed though - it won't start happening to all messages. Also, the data will have been data that was already received. So if it's for example the battery voltage message, then it's not a big deal to miss it. As long as there aren't links rapidly being lost and gained, then this shouldn't happen often. Note that as the buffer size is increased, I believe that this becomes more likely to happen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14958</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14958"/>
		<updated>2013-04-28T00:24:16Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://3.bp.blogspot.com/-jI7EMZ_0614/UXMjlc1MoBI/AAAAAAAAEZo/LwOgVQN336o/s640/Screenshot+from+2013-04-15+22_59_01.png&lt;br /&gt;
&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14957</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14957"/>
		<updated>2013-04-28T00:23:05Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
===Reasons to use this===&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Caption: The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_comms&amp;diff=14956</id>
		<title>Redundant comms</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_comms&amp;diff=14956"/>
		<updated>2013-04-27T23:51:37Z</updated>

		<summary type="html">&lt;p&gt;Camlee: moved Redundant comms to Redundant Communication:&amp;amp;#32;Want to change main title.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Redundant Communication]]&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14955</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14955"/>
		<updated>2013-04-27T23:51:37Z</updated>

		<summary type="html">&lt;p&gt;Camlee: moved Redundant comms to Redundant Communication:&amp;amp;#32;Want to change main title.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Redundant Communication ==&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Main Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://2.bp.blogspot.com/-4ytdpqXMHa0/UXMlR-qGkbI/AAAAAAAAEZw/JO959QjWip4/s1600/Screenshot+from+2013-04-15+23_02_27.png&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14954</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14954"/>
		<updated>2013-04-27T23:50:29Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Redundant Communication ==&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. Communication from the ground to the aircraft is called datalink. This communication allows the commands to be sent to the aircraft from the ground. This includes telling the aircraft what navigation to perform: waypoint navigation, search area, landing. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, no telemetry information can be displayed in the GCS and commands sent from the GCS won't be sent to the aircraft. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite modem for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
* You could use this system to evaluate different types of radio modems or antenna placements - you'll get real time info on each such as the ping time, received messages rate, and more information can easily be added.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
This project was made to be fully backwards compatible and support the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include the status of each link as it was during the flight.&lt;br /&gt;
* Link features such as USB-serial, audio, UDP, different transport layers, etc...&lt;br /&gt;
* Multi-aircraft sessions - you can use redundant links for one aircraft, but not for another if desired&lt;br /&gt;
* Multiple aircraft connected to the same link - such as might come up in a mesh configuration where one aircraft relays data from another aircraft&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Main Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Then, use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://2.bp.blogspot.com/-4ytdpqXMHa0/UXMlR-qGkbI/AAAAAAAAEZw/JO959QjWip4/s1600/Screenshot+from+2013-04-15+23_02_27.png&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14953</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14953"/>
		<updated>2013-04-27T23:23:35Z</updated>

		<summary type="html">&lt;p&gt;Camlee: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Redundant Communication ==&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
Communication from the aircraft to the ground is called telemetry. This communication allows the status of the aircraft such as location, altitude, airspeed, battery level, current flight block, and much more to be monitored in real time. If a single link is used, as is typical, then if the plane goes out of range, or that link is otherwise lost, none of this information can be displayed on the GCS. Using the following redundant link system allows multiple links to be used in an effort to avoid this. Typically, you would introduce diversity when adding links. For example:&lt;br /&gt;
* If you have an on-board computer, you could tunnel messages through Wi-Fi over UDP in addition to a traditional 900 MHz XBee radio modem.&lt;br /&gt;
* You could use a satellite phone for long-range monitoring in addition to a radio modem.&lt;br /&gt;
* You could use a cellular modem in addition to a radio modem.&lt;br /&gt;
* With additional ground infrastructure, you could have radio modems located at different locations.&lt;br /&gt;
* You could use radio modems at different frequencies or with different antenna gains or orientations.&lt;br /&gt;
&lt;br /&gt;
There are undoubtedly many more possibilities.&lt;br /&gt;
&lt;br /&gt;
This project was made to be fully backwards compatible and support some of the awesome functionality that Paparazzi already has. This includes:&lt;br /&gt;
* Completely backwards compatible - includes aircraft configuration files, previous flight logs, existing sessions, etc...&lt;br /&gt;
* Logging and replay - if multiple links are used, data received through either link is recorded. Also, replays will include &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Aircraft to Ground ==&lt;br /&gt;
&lt;br /&gt;
===Features===&lt;br /&gt;
Enabling redundant communication from the aircraft to the ground enables the following features:&lt;br /&gt;
* Redundancy - as long as one link is receiving data, it will be logged and displayed on the GCS&lt;br /&gt;
* Monitoring - the status, ping time, and rate of receiving messages for each link is shown (this makes it useful even if you're only using one link)&lt;br /&gt;
* Alerts - new alerts are added to the console in the GCS to alert you when a link has been connected for the first time, lost, or re-gained.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
For an example session using two USB-serial adaptors, see the Flight USB-serial Redundant session saved in the example control_panel.xml configuration (on master branch, once the pull request has been accepted).&lt;br /&gt;
&lt;br /&gt;
For the details, keep reading:&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx pin of the autopilot to multiple radio modems or whatever other device which will get the information to the ground. On the ground side, connect multiple modems as normal (using USB to serial adapters, a UDP connection, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Configure the agents as you would have before (serial port, baud rate, UDP, etc...). None of these features have been modified or removed. Use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent. This agent listens to all of the Link agents that have their -redlink set and combines the data.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a session with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
&lt;br /&gt;
http://2.bp.blogspot.com/-4ytdpqXMHa0/UXMlR-qGkbI/AAAAAAAAEZw/JO959QjWip4/s1600/Screenshot+from+2013-04-15+23_02_27.png&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Aircraft ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
	<entry>
		<id>http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14952</id>
		<title>Redundant Communication</title>
		<link rel="alternate" type="text/html" href="http://wiki.paparazziuav.org/w/index.php?title=Redundant_Communication&amp;diff=14952"/>
		<updated>2013-04-27T22:31:35Z</updated>

		<summary type="html">&lt;p&gt;Camlee: Created page with &amp;quot;== Redundant Communication == There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparaz…&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Redundant Communication ==&lt;br /&gt;
There is currently a pull request to integrate a redundant communication system into the existing ground segment agents: [https://github.com/paparazzi/paparazzi/pull/429]. The goal of this project is to allow multiple radio modems or other links be used between the aircraft and the ground station in a redundant fashion so that even if one link is lost, communication can be maintained. So far, the plane to ground component has been created and tested. The ground to plane component has not been created yet.&lt;br /&gt;
&lt;br /&gt;
== Plane to Ground ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How to use===&lt;br /&gt;
&lt;br /&gt;
In order to implement redundant links using this code, there are three simple steps to follow:&lt;br /&gt;
&lt;br /&gt;
* Connect the hardware - on the airborne side, connect the Rx of the autopilot to multiple radio modems. On the ground side, connect multiple modems as normal (using USB to serial adapters, or whatever).&lt;br /&gt;
* Launch a Link agent for each modem. Use two new command line arguments: -redlink and -id. The -redlink flag tells Link that it's one of multiple links. The -id flag lets you specify an integer number as the id of that particular link.&lt;br /&gt;
* Launch the Link Combiner agent.&lt;br /&gt;
&lt;br /&gt;
The following screenshot shows a setup with two links, connected to serial ports ttyUSB0 and ttyUSB1, and with id's 1 and 2:&lt;br /&gt;
[[File:Example.jpg]]&lt;br /&gt;
&lt;br /&gt;
The Agents Running in a Redundant Link Setup&lt;br /&gt;
&lt;br /&gt;
== Ground to Plane ==&lt;/div&gt;</summary>
		<author><name>Camlee</name></author>
	</entry>
</feed>