-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.py
More file actions
45 lines (31 loc) · 1.01 KB
/
main.py
File metadata and controls
45 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import time
from infinite_sense_core.infinit_sense import Synchronizer
from infinite_sense_core.message import Messenger
class DemoSensor:
def initialization(self):
print("MockSensor initialized")
def start(self):
print("MockSensor started")
def stop(self):
print("MockSensor stopped")
def imu_callback(msg_bytes, size):
print(f"Received IMU data of size {size}")
def image_callback(msg_bytes, size):
print(f"Received image data of size {size}")
def main():
synchronizer = Synchronizer()
synchronizer.set_net_link("192.168.192.188", 8888)
sensor = DemoSensor()
synchronizer.use_sensor(sensor)
synchronizer.start()
messenger = Messenger.get_instance()
messenger.sub("imu_1", imu_callback)
messenger.sub("cam_1", image_callback)
try:
while True:
time.sleep(0.1)
except KeyboardInterrupt:
print("\n检测到键盘中断,正在停止同步器...")
synchronizer.stop()
if __name__ == "__main__":
main()