Created
October 18, 2025 17:59
-
-
Save VictorXLR/801cadd205953d544a05e869bec9a114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import struct | |
| import zmq | |
| context = zmq.Context() | |
| socket = context.socket(zmq.SUB) | |
| # IMU uses 5556, point cloud uses 5555 | |
| socket.connect("tcp://192.168.1.249:5556") | |
| socket.setsockopt(zmq.SUBSCRIBE, b"") | |
| while True: | |
| data = socket.recv() | |
| # Parse IMU data | |
| seq, stamp_sec, stamp_nsec = struct.unpack('<III', data[0:12]) | |
| quat = struct.unpack('<ffff', data[12:28]) | |
| ang_vel = struct.unpack('<fff', data[28:40]) | |
| lin_acc = struct.unpack('<fff', data[40:52]) | |
| print(f"IMU seq {seq}: quat={quat}, ang_vel={ang_vel}, lin_acc={lin_acc}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment