How to use Python SDK to get position data?

14 Feb 2022, 14:52

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?

Log in to reply
21 Mar 2022, 08:50

@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.

22 Mar 2022, 08:49

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

1 May 2022, 07:08

@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.

5 May 2022, 18:01

@song-yi-wei great answer

Log in to reply