import os import serial import sys import threading import time from reader import ins # Main reader = ins() reader.connect() if reader.isClosed() == False: read_thread = threading.Thread(target=reader.dump) read_thread.start() read_thread.join() else: print "Could not connect!"
count = 0 while(count < points): buffer_heading[count] = ins.readline() count = count + 1 print "INS collection time: "+str(time.time() - start_time) return try: t1 = Thread(target=read_lidar) t2 = Thread(target=read_ins) t1.start() t2.start() t1.join() t2.join() for number in buffer_theta: ft.write(str(number)+",") for number in buffer_dist: fd.write(str(number)+",") for number in buffer_heading: fh.write(str(number)+",") return except: return lidar = rplidar(device="/dev/ttyUSB8") lidar.connect() ins = ins() ins.connect() write_file() ft.close() fd.close() fh.close() exit(0)
print "INS failed to connect!" exit(1) print "Connected to INS!" # Hampel Filter (Removal of Outliers) def HampelFilter(wk,K,FilterParms): None # Could be difficult # Moving Average Filter (Smoothing out Data) def moving_average_filter(): None # Shouldn't be too bad # Point correlation to determine if it's similar def point_correlate(): None # Direction Vector Calculate def dir_vector(xold,yold,xnew,ynew): return [(xnew-xold),(ynew-yold)] # Gather # Main rplidar = rplidar(device='/dev/ttyUSB0') ins = ins(device='/dev/ttyACM0') connect(rplidar,ins)