Live Resource Selector

The LiveResourceSelector module in Air SDK provides an interface to discover and request live video resources (streams) from available onboard cameras. It is typically used during a mission to manage both static and dynamically changing video sources, depending on the operational context.

This system is particularly useful when dynamically selecting or binding a video stream to a processing pipeline (e.g. neural network inference, metadata overlay, etc.). It also enables missions to query and track the availability of onboard camera resources in real time.

Overview

The LiveResourceSelector manages the discovery and selection of live video resources and notifies the mission logic when a camera has been successfully attached to a target stream.

It works in conjunction with the arsdk::camera types, using:

  • StreamReceiver (e.g., DEFAULT, SKYCONTROLLER)

  • CameraType (e.g., DEFAULT, FRONT, HORIZONTAL_STEREO_LEFT, EXTERNAL)

Initialization

To use it, instantiate a LiveResourceSelector by providing a unique mission UID and a pointer to an object implementing the LiveResourceSelectorListener interface:

airsdk::live_resource_selector::LiveResourceSelector selector(
    "my_mission_uid", myLiveResourceListener);

Alternatively, provide an existing pomp::Loop to manage the event loop manually.

LiveResourceSelector Listener

Implement the LiveResourceSelectorListener interface to handle responses from the selector:

class MySelectorListener : public LiveResourceSelectorListener {
public:
    void onLiveResourceList(std::vector<LiveResourceInfo> resources) override;

    void onNotifyStreamCamera(arsdk::camera::StreamReceiver receiver,
                              arsdk::camera::CameraType type,
                              std::string uid) override;
};

Live Resource Structure

The structure LiveResourceInfo provides details for each discovered resource:

  • type: Camera type (e.g., DEFAULT, FRONT, HORIZONTAL_STEREO_LEFT, EXTERNAL)

  • is_dynamic: Whether the resource is dynamically added

  • description: Human-readable text describing the resource, included in the SDP for stream identification.

  • path: Internal video IPC path name (used for stream/resource binding)

Querying Resources

Call getLiveResourceList() to asynchronously retrieve the list of available camera resources. The results are delivered via the onLiveResourceList() callback.

selector.getLiveResourceList();

Requesting a Camera Stream

To request a specific receiver to stream a specific camera, call requestStreamCamera():

selector.requestStreamCamera(
    arsdk::camera::StreamReceiver::DEFAULT,
    arsdk::camera::CameraType::DEFAULT,
    "my_mission_uid");

Calling this method will invoke onNotifyStreamCamera() once the camera-stream assignment is complete.

If the requested stream receiver is absent (e.g., no HDMI screen connected to the SkyController), no onNotifyStreamCamera() callback is triggered.

Stopping the Selector

Call stopLiveResourceSelector() to terminate the service and release associated resources:

selector.stopLiveResourceSelector();

Thread and Loop Management

  • If using his own pomp::Loop, the caller is responsible for regularly calling loop.waitAndProcess() to process events.

  • Otherwise, LiveResourceSelector will run an internal event loop on a dedicated thread.

Use Cases

  • Switching between default camera and external camera at runtime.

  • Dynamically allocating a video stream to an inference engine.

  • Displaying the list of available resources in the mission user interface.

Reference

See airsdk/live_resource_selector/LiveResourceSelector.hpp for complete API documentation.

Related Enums:

```

  • arsdk::camera::StreamReceiver

  • arsdk::camera::CameraType

```