Auterion App SDK
Auterion SDK is a library that can be used by AuterionOS apps to communicate with the system.
Loading...
Searching...
No Matches
auterion::ObjectDetectionClient Class Reference

Provides access to 2D object detections from the system. More...

#include <auterion_sdk/object_detection/object_detection_client.hpp>

Public Member Functions

 ObjectDetectionClient (SDK &sdk, const std::string &detections_topic="object_detection/detections_2d", const std::string &enabled_topic="object_detection/detections_2d_enabled")
 Construct a new Object Detection Client object.
 
virtual ~ObjectDetectionClient ()
 Destroy the Object Detection Client object.
 
 ObjectDetectionClient (const ObjectDetectionClient &)=delete
 
ObjectDetectionClientoperator= (const ObjectDetectionClient &)=delete
 
 ObjectDetectionClient (ObjectDetectionClient &&)=delete
 
ObjectDetectionClientoperator= (ObjectDetectionClient &&)=delete
 
Detections2DSubscriptiondetections2D () const
 Get the detections2D subscription.
 
ObjectDetectionClientsubscribeDetections2D (Detections2DCallback callback=nullptr)
 Subscribe to 2D object detections.
 
void enableObjectDetection ()
 Publishes a message to enable the object detection service. The publisher will receive this message and enable the object detection service.
 
void disableObjectDetection ()
 Publishes a message to disable the object detection service. The publisher will receive this message and disable the object detection service.
 

Detailed Description

Provides access to 2D object detections from the system.

Example usage:

To register a custom callback on the 2D detections:

auterion::ObjectDetectionClient object_detection_client{sdk};
// Subscribe to detection updates
object_detection_client.subscribeDetections2D([](const ImageDetections2D& detections) {
std::cout << "Received " << detections.detections.size() << " detections" << std::endl;
});
Provides access to 2D object detections from the system.
Definition object_detection_client.hpp:142
SDK execution class. All callbacks are called on the same thread.
Definition auterion.hpp:97
Contains 2D detections for a specific image.
Definition image_detections_2d.hpp:44
std::vector< Detection2D > detections
List of 2D detections in the image.
Definition image_detections_2d.hpp:46

To query the latest known 2D detections:

auterion::ObjectDetectionClient object_detection_client{sdk};
// Activate subscription process without registering a callback
object_detection_client.subscribeDetections2D();
// Retrieve latest detections
auterion::ImageDetections2D detections = object_detection_client.detections2D().last();

To control the object detection service:

auterion::ObjectDetectionClient object_detection_client{sdk};
// Enable the object detection service
object_detection_client.enableObjectDetection();
// Later, disable the service when no longer needed
object_detection_client.disableObjectDetection();

Constructor & Destructor Documentation

◆ ObjectDetectionClient()

auterion::ObjectDetectionClient::ObjectDetectionClient ( SDK sdk,
const std::string &  detections_topic = "object_detection/detections_2d",
const std::string &  enabled_topic = "object_detection/detections_2d_enabled" 
)

Construct a new Object Detection Client object.

Parameters
sdkThe SDK instance to use for creating clients.
detections_topicTopic name for subscribing to 2D detections.
enabled_topicTopic name for publishing detection enabled state.

Member Function Documentation

◆ detections2D()

Detections2DSubscription & auterion::ObjectDetectionClient::detections2D ( ) const

Get the detections2D subscription.

Returns
Reference to the detections2D subscription.

◆ subscribeDetections2D()

ObjectDetectionClient & auterion::ObjectDetectionClient::subscribeDetections2D ( Detections2DCallback  callback = nullptr)
inline

Subscribe to 2D object detections.

Parameters
callbackThe callback function to be invoked when new detections are received.
Returns
Reference to this object for method chaining.

The documentation for this class was generated from the following file: