How to use Python SDK to get position data?

I checked the sample code in but couldn't figure it out how to get the position data from the driver. Are there any documentation for the sdk?

@chengyong I was unable to open the document with Libre and MS Office.
But I figured out that the best for me is using Driver class and create a function to process the continous data.

@k2ironman So you need to write your own code to do that。 (Process serial port data according to protocol)

@k2ironman Below is some references for you,

  1. pip install openimu
  2. sample code
import time
import threading
from import Detector

def handle_receive_continous_data(packet_type, data):
    # the position data will be in packet_type equals 'pos'
    print(packet_type, data)

def on_find_device(device):
    # prepare to use
    # listen the output data
    device.on('continous',  handle_receive_continous_data)

def prepare():
    detector = Detector(
        com_port='{DEVICE COM}',

if __name__ == '__main__': 

    while True:

For more advance usage, please take a look of the source code.

@song-yi-wei great answer

Log in to reply