Radio Streams: How they work
All data send over radio in Ruby is composed at the basic level of streams, which are split up in stream packets, similar with Real-time Transport Protocol.
Streams packets can be sent on one or multiple radio links, between controllers and vehicles or to/from an arbitrary number of relay nodes.
A stream packet (also called stream segment) is just a data structure composed of a header and actual payload data.
The header contains information that Ruby uses to decide how to route the packet over the radio links (any radio link, be it a controller radio link, a vehicle radio link or a relay radio link).
* There are multiple type of streams. For example there are video streams and data streams. The distinction is needed as there can be constrains applied in routing of radio packets. For example, video streams are never routed on radio links that have low bandwidth (i.e. 433Mhz telemetry radios);
* There can be multiple streams of the same type, each one is independent of each other. For example there can be multiple video streams, from mulitple cameras or relayed vehicles or multiple data streams, like when users adds it's own plugins to send data, or both;
* The source and destination id denotes the originator of a stream and the final destination of a stream, no matter how many intermediate radio points the packet travels through. These Id-s uniquely identify any physical component present in the system (controllers, vehicles, relays).
Streams Packets Routing:
All Ruby instalations (controllers, vehicles, routers) have an internal component, called here Streams Packets Router, that handles the routing of stream packets to/from different radio links and radio interfaces and the components that generate or consume those data/video streams:
- The router receives stream packets for various streams from different components (i.e. video streams, telemetry streams, user custom data streams, radio interfaces, like for example when a relay is involved);
- The goal of the router is to figure out how to route the stream packets to the appropiate radio interfaces or consumer components, based on the capabilities of the radio links, radio interfaces and the consumers;
- Part of the router responsability is also to eliminate duplicate stream packets, when a stream packet is received twice (for example, if it was sent over multiple radio links or if it was received by multiple radio interfaces;
- The router has no knowledge of what is contained in the payload of the stream packet (except for knowing the stream type). All the information it needs to route the stream packets is contained in the stream packet header;
- When appropiate, the router will concatenate multiple stream packets to be sent over radio as a single packet, when this makes sense, as it saves some data overhead on the radio stack;
There are no priorities in Ruby. All streams have equal priority, no matter the type of the stream and where they come from and where they go to.
The exception to this rule are the following, which have the highest priority in the system, over all other streams:
- A Ruby internal data stream that is used to measure radio links quality and radio links round trips;
- Requests for retransmission that Ruby generates for missing streams packets (when needed, if a stream is defined as requiring retransmission of missing data);
Overall, Ruby radio network is a decentralised network.
Each node has information about it's neighbours and how to route packets in it's vicinity.
Stream packets travel through the radio network untill they reach their destination.
Radio Links: How they work