set_predictions_callback()¶
This method allows you to set either a synchronous or an asynchronous callback, which will be triggered each time a new message arrives in the predictions topic. If callback_async is defined, the callback is ignored. One of the callbacks must be defined.
Reference¶
Arguments¶
Arguments |
Type |
Default value |
Description |
|---|---|---|---|
callback |
|
|
Callback that will be invoked when a prediction arrives. |
callback_async |
|
|
Async callback that will be invoked when a prediction arrives. |
as_dict |
|
|
If set to |
call_without_predictions |
|
|
If it is set to |
Return¶
None
Exceptions¶
None
See the complete list of cv exceptions.
Examples¶
def callback_prediction(self, msg):
self.prediction_received = True
...
self.predictor.set_predictions_callback(
callback=self.callback_prediction,
as_dict=True,
call_without_detections=True,
)
...
...