dai.RemoteConnection 并注册自定义可视化服务回调。它启动了一个简单的命名服务(myService),该服务在远程调用时返回固定响应。此示例需要 DepthAI v3 API,请参阅 安装说明。管道
源代码
Python
PythonGitHub
1#!/usr/bin/env python3
2import depthai as dai
3import signal
4import sys
5import time
6
7isRunning = True
8def stop():
9 global isRunning
10 isRunning = False
11
12def signal_handler(sig, frame):
13 print('You pressed Ctrl+C!')
14 stop()
15 sys.exit(0)
16
17signal.signal(signal.SIGINT, signal_handler)
18
19remoteConnection = dai.RemoteConnection()
20
21def testService(input):
22 print("Test service called with input:", input)
23 return {"result": "testService result"}
24
25remoteConnection.registerService("myService", testService)
26while isRunning:
27 time.sleep(1)需要帮助?
请前往 Discussion Forum 获取技术支持或提出您可能有的任何其他问题。