ADAPTERS
Adapters are what allows for the current MicroCART GroundStation BackEnd to communicate with other vehicles. The adapters act as a translator by receiving packets from groundstation and performing the appropriate operation to get the packet to its destination. There are currently two adapters, one for the crazyflie (cflib_groundstation folder) and one for the FlyPi (flypi_adapter). Both are written in python, and the FlyPi adapter will run on the Linux on the Raspberry Pi instead of the development PC.
CRAZYFLIE ADAPTER
The Crazyflie adapter uses the cflib library created by Bitcraze to interface with the radio and send packets to the drone. The adapter essentially works by having the groundstation_socket class handle the TCP connection to the BackEnd. Whenever a packet is received on the socket, ground_station_socket decodes the packet, assigns it the appropriate type, and places it in the main queue for processing. The main class starts all of the threads and holds the queues. It pulls items off the input queue, and based on the message's type calls the appropriate function in cf_connection. cf_connection interprets the message and calls a cflib function with the appropriate. Any output from cflib is turned into another message which is placed into the output queue. The exception to this is logging data, which is sent to a separate thread. This is handled by the LogFileHandler class, which handles writing log data to files and reading the loggingBlocks.txt file.
The crazyflie adapter can be run by using the following command in the cflib_groundstation folder:
python3 main.py [radio number]
FLYPI ADAPTER
The FlyPi adapter is intended to be run on the ubuntu cores of the Raspberry Pi Zero 2. It will follow essentially the same structure as crazyflie adapter, except for instead of using cflib it will place packets into the shared memory buffer. The flypi_adapter folder has a memory_handler class that provides a very simple shared memory writing interface. This should be expanded by future teams to complete a more robust shared memory buffer.