Communication protocol
Embedded into raw protocol. Used to send single messages to drone or ground station. Used to change settings. Implemented into communication module.
What can it do?
Request settings and configuration of drone, ground station and camera
Change settings for all kinds of applications
Request & send firmware/hardware version
Easily to be extended to send any command to ground station or drone. Like shell commands
The communication protocol is implemented by the communication module. It is designed to send single messages that do not need high update rates. That way it is not necessary to map an RC channel to the desired function. RC switches are updated about 60 times/second and thus create a lot of interference.
This protocol is based on JSON which can be transported using the DroneBridge Raw protocol (Groundstation <--> Drone) or any standard network protocol like UDP/TCP (wifi mode or USB tethering)
Structure
Defined Messages
Parameter Request
Request all possible settings parameters that can be changed via a settings request. This does not request the parameter values.
Parameter Response
Return all settings parameters within the requested sections.
Settings Request
Request of specific sections and keys of the config file. Destination can be 1, 2, 5
Settings Response
Settings Change Request
Change specific settings of the specified sections. Destination can be 1, 2 or 5
Settings Change Success Message
On successful settings change.
System Identification Request
System Identification Response
"Calibrate" RC/Joystick
This is no real calibration. "jscal" is told to use the full range for each axis provided by the HID (eg -127 to 127). By default the system may only use values from -125 to 125 and adds a dead zone. As the user needs to calibrate his RC locally it is not necessary to do it all over again on the ground station. We just make sure the fully range is used.
Ping Request
Ping Response
Error Response
ACK Response
Universal acknowledgement message. May be returned by any kind of request/change message.
Fields
CRC32
CRC32 of the entire JSON as implemented by the Python package binascii
binascii.crc32('my payload JSON')
Sequence Diagramms
Adding a custom message to the communication module
The communication module can transport messages of all kind. If a known message is received it does something. What it does is totally up to the users implementation. Often a user wants to send some sort of trigger to the UAV or ground station. Back in the days it was common to use one of the RC channels to trigger all sorts of actions. This is not very efficient since the RC sends all channels about 100 times/second even if you do not need that high update rates for your action. A simple camera ON/OFF switch would be an example.
So let's say you want to change some setting of a camera connected to your AirPi. To do that you need to execute a command like mycam -- shuterspeed 500
on the AirPi. What you do to implement this into DroneBridge is the following:
Define a custom message that follows the specification of the communication protocol. Just like the new adjustrc message. You can put as many parameters in there as you need. Your message could look like this:
The parameters destination, type and id are mandatory.
Make the communication module aware of the new message & write the code that should be executed. Add an if-clause that runs if your defined message-type is received
Generate a return message to let the user know your message was received. Eg. it is as simple as calling rtrn_message = new_ack_message()
That's it! Now just send your newly defined message via UDP to the communication module and let it do the rest. Here is an example on how to generate the entire communication message including the CRC32 at the end from a json. This will return the pure bytes of the message that now can be sent to the communication module (UDP: Port 1605) of the ground station.
With just a few lines of code, a user can implement any custom functionality with ease. No need to waste or flood the carrier with RC channels. No need to generate huge amounts of traffic.
Last updated