How to use Python SDK to get position data?

I checked the sample code in USAGE.md 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 aceinna.tools 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
    device.setup(None)
    # listen the output data
    device.on('continous',  handle_receive_continous_data)

def prepare():
    detector = Detector(
        device_type='OpenRTK',
        com_port='{DEVICE COM}',
        baudrate=460800)
    detector.find(on_find_device)

if __name__ == '__main__': 
    threading.Thread(target=prepare).start()

    while True:
        time.sleep(10)

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

@song-yi-wei great answer

Log in to reply