Integration for FPV means ‘integrating’ with other applications and utilities that you may have on your ground station or network. At the moment there are three integration capabilities:
- A script or utility that queries RSSI, noise floor and signal quality of the onboard wireless transmitter module. This information is then sent at regular intervals to the FPV application using the “Signal” message.
- Connecting and publishing a “trajectory” message to the FPV application to build a virtual tunnel. (see the “FPVNav” iPhone/iPad app in the “extras” section).
- Subscribing and receiving a “vehicle” message from the FPV app, which can be used to update vehicle position and direction in a different application.
The FPV app has two channels of communication, one to publish information and one where it subscribes to information. These channels use “ZeroMQ” sockets, one of type ZMQ_SUB to receive information, the other of type ZMQ_PUB to publish information. The subscription channel is open on port 5600, the publication channel is at 5601.
To communicate data from a range of platforms, endianness and so forth, I’ve opted for the use of “Protobuf” to specify the messages. Each message used in the FPV app is detailed below.
This information so far can be a bit confusing. It’s better to show you a small example in Python, which is how I query the RSSI from my wifi module and forward this to the FPV app: example python script.
Protobuf and ZeroMQ are available on a number of platforms and for a number of programming languages.
I’ll explain the example above in Python. The amount of code written in other languages is similar in size and notation.
First we create a “ZMQ” context which manages our “application sockets”. This context is used to create a “publication” socket, because the FPV app uses a subscription socket to listen for information. You can connect as many publishers as you want to the same port. The connect is initiated from each app connecting to FPV.
context = zmq.Context() # Socket to talk to server zmqsck = context.socket(zmq.PUB) zmqsck.connect ("tcp://localhost:5600")
Once connected, threads are started by the ZMQ context in the background to deal with the data transfer. In the following bit of code, we create a “protobuf” message of type “Signal”. This message is populated with the necessary data, serialized into a string and sent off over the ZMQ socket:
msg = Signal_pb2.Signal() msg.messageType = 'SI' msg.noiseFloor = obj[ 'noisef' ] msg.signal = obj[ 'signal' ] msg.rssi = obj[ 'rssi' ] zmqsck.send ( msg.SerializeToString() )
The following table shows the available messages. The messages that FPV app accepts on port 5600:
The messages that are sent out by the FPV app: