Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The SDK C++ API provides an object-based interface for controlling/configuring the radar and for processing incoming data.

Communication to the radar is asynchronous: * Outgoing messages are encapsulated within API calls. The parameters provided to the functions are used to populate Colossus messages, which are sent to the sensor. * Incoming messages from the sensor invoke callbacks. Each (supported) incoming message will have a callback function object associated with it. The callback is passed a (shared) pointer to the received data.

The API handles all endianness and encoding required by the Colossus protocol; removing the need from the client.

Connecting to the sensor

The steps involved in connecting and getting data are as follows:

Setup your radar client and hook up the message and connection events:

Code Block
#include "radar_client.h"

int main()
{
    Navtech::Radar_client radar_client { "127.0.0.1"_ipv4 };

    // See below for details on message handler callbacks
    //
    radar_client.set_configuration_data_callback(config_handler);
    radar_client.set_fft_data_callback(fft_handler);

    ...
}

Connect to the radar:

Code Block
int main()
{
    Navtech::Radar_client radar_client { "127.0.0.1"_ipv4 };

    radar_client.set_configuration_data_callback(config_handler);
    radar_client.set_fft_data_callback(fft_handler);

    // Connect to the radar
    //
    radar_client.start();
}

On successful connection you will receive a Configuration message with details of the radar's current configuration. So you must have the handler setup before you connect.

Message handler callbacks

An incoming Colossus message will be unmarshalled and stored in a message-specific structure.

Each structure also defines a pointer type (usually a std::shared_ptr). This pointer type is used to allocate, and then access, the structure object created from the incoming Colossus message.

The message handler callback must be a Callable Type - a function, a member-function, a function-object or a lambda expression.

The signature of the Callable Type for a data item of type Message_Ty depends on the type of the Colossus message being received; for example:

Code Block
void (*callback_fn_ptr)(                                      // Configuration data
    const Configuration_data::Pointer&,
    const Configuration_data::ProtobufPointer&
);

void (*callback_fn_ptr)(const Fft_data::Pointer&);            // FFT data

void (*callback_fn_ptr)(const std::vector<std::uint8_t>&);    // Raw FFT data      

WherePointeris the message structure-specific pointer type.

For example:

Code Block
void config_handler(
    const Configuration_data::Pointer& data, 
    const Configuration_data::ProtobufPointer& protobuf_config
)
{
    // Process incoming configuration...
}

Once connected and you have the config data, tell the radar to start sending FFT Data:

Code Block
radar_client.start_fft_data();

You must provide a incoming FFT Data:

Code Block
void fft_handler(const Fft_data::Pointer& data)
{
    // Process incoming FFT data...
}

When you need to disconnect, firstly stop the FFT Data:

Code Block
radar_client.stop();

Then unbind the data handlers:

Code Block
radar_client.set_fft_data_callback();
radar_client.set_configuration_data_callback();

Then disconnect:

Code Block
radar_client.stop();

The file testclient_main.cpp contains an example of basic configuration and FFT data processing operations. It can be used as the basis for more complex applications.

C++ Source Code

This code is a series of classes developed using C++ 11. The source code for end users to easily integrate into their application, regardless of the target platform, is available at https://bitbucket.org/navtechradar/iasdk-public/src/master/cpp/

The code targets the following compilers:

...

GCC 4.8 and above

...

See information describing the core features here, in the earlier C++11 implementation.

As described below, this C++17 implementation additionally includes the source code of a peak finding function - and it is the same functionality that is implemented within the radar firmware to enable Navigation Mode

This version of the SDK was developed on Ubuntu 20.04

Code Block
sudo apt install build-essential clang g++ protobuf-compiler libprotobuf-dev cmake

Building using CMAKE

This assumes that the SDK has been cloned into ~/iasdk

Code Block
mkdir ~/build_iasdk
cd build_iasdk
cmake -DCMAKE_BUILD_TYPE=Release ~/iasdk/cpp_17
make -j

Notes

Preferred compiler for building is Clang V10 but GCC 9.3.x should work

The code uses using statements to make pointer ownership more obvious:

  • Owner_of is a std::unique_ptr;

  • Shared_owner is a std::shared_ptr;

Please see utility/Pointer_types.h for a full explanation.

Peak Finding

The class Peak_finder can be used to process FFT data and search for peaks. The algorithm will sub-resolve within radar bins and return a power at a distance in metres on the azmith being checked.

The algorithm implemented here will slide a window over the FFT data moving forwards by the size of the window, when the FFT has risen and then fallen, the peak resolving algorithm is run to sub-resolve the distance.

See Peak_finder.h for the data structure that is generated per azimuth

The navigation_main.cpp is a sample application that will peak search and report back up to ten targets per azimuth.

  • threshold - Threshold in dB

  • bins_to_operate_on - Radar bins window size to search for peaks in

  • start_bin - Start Bin

  • buffer_mode - Buffer mode should only be used with a staring radar

  • buffer_length - Buffer Length

  • max_peaks_per_azimuth - Maximum number of peaks to find in a single azimuth