This repository contains the source code for the core communications protocol library for the Apache Strap-Down Pilotage program.
It implements the protocol described in the ASDP Software Architecture document using the approach described in the ASDP API Implementation document.
The docs/ directory contains additional documentation, including the following:
- Camera distortion
- ASDP System Architecture
- ASDP Software Architecture
- ASDP API Implementation
- System tuning
Build and Install: ASDP_Core_API uses CMake to configure the builds (though other build systems could be used). On Ubuntu Linux, this can be done as follows
sudo apt install cmake
cd; mkdir src; cd src; git clone https://github.com/arizonaCameraLab/ASDP_Core_API
cd; mkdir -p build/ASDP_Core_API; cd build/ASDP_Core_API
cmake -DCMAKE_BUILD_TYPE=Release ../../src/ASDP_Core_API
make
sudo make install
Documentation: The primary documentation is available in DOxygen, and is generated by as part of the build process when DOxygen is available. On Ubuntu Linux, this can be generated as follows:
sudo apt install doxygen- When you build using CMake, it will build DOxygen by default.
- Open doc_doxygen/html/index.html with a web browser to view the documentation.
Test: CMake includes the concept of test applications. You can run the tests
by running make test in the build directory.
When using CMake, the following lines in the CMakeLists.txt file will set the include directory and link the program against the installed library:
find_package(ASDP_Core_API REQUIRED)
add_executable(ASDP_Core_Test ASDP_Core_Test.cpp)
target_link_libraries(test ASDP_Core_API::ASDP_Core_API)
Compiling a C++ program by hand consists of including the header files (which are installed in /usr/local/include on Linux) and linking against the ASDP_Core_API library (installed in /usr/local/lib) and its dependencies. The C++ programs use C++-11. An example compilation for the ASDP_Core_Test.cpp program follows:
c++ --std=c++11 ASDP_Core_Test.cpp -o ASDP_Core_Test -lASDP_Core_API -lpthread
There are also utility classes included in the library, each of which has an associated header file. These include:
- ASDP_BufferPool - A thread-safe asdp::BufferPool class to manage a pool of buffers.
- ASDP_SpinFreeQueue - A thread-safe asdp::SpinFreeQueue class to manage a queue without spin-waiting.
- ASDP_SpinFreeAccurateTimer - A thread-safe asdp::SpinFreeAccurateTimer class that uses a single spin-waiting thread to service multiple threads that must launch tasks at specific times.
The program Speed_Test_Receiver can be used to test the speed of the communications protocol, including the option to test the speed of writing to output files. It pairs with the Speed_Test_Sender program to enable tests to be run. The default behavior is to run using loopback for 10 seconds with 25 cameras at 60 Hz. It does not use the actual camera message types or StreamPackets, but it does verify that no packets are skipped. The program describes its usage when it is run.
The program Speed_Test_Sender pairs with the Speed_Test_Receiver program to enable tests to be run. The program describes its usage when it is run.
The network_tuning.sh script can be used to configure the network for the ASDP servers on a Linux system. It configures the MTU, the global receive buffer size, and the the global UDP buffer pool size. It also downloads and runs the Mellanox tuning script. (On the laptop using the ATTO ThunderLink 5102, use the network_tuning_ATTO.sh script instead.)
To ensure that this runs at boot time, you can copy the script to /usr/local/bin and then add the following into a new file named /etc/systemd/system/network_tuning.service:
[Unit]
Description=ASDP Network Tuning
Wants=network.target
After=network.target
[Service]
ExecStart=/usr/local/bin/network_tuning.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Then run sudo systemctl enable network_tuning.service to enable the service.
The Python script Make_Camera_Config_File.py can be used to generate a regular-layout camera configuration file for the ASDP system. The script describes its usage when it is run with the --help command-line option. The --simulation option constructs additional information for use by the FlightSim repository to generate a flight path or calibration data with oversized cameras and distorted images and colors. The --cropPixels option can be used to mark edges of the image as not containing valid data; this will cause FlightSim programs to fill these regions with zeroes and will inform ASDP_Render_Module and others to ignore these regions.