fast imu
This commit is contained in:
@@ -117,7 +117,7 @@ def run_live(port, baud, save_csv=None):
|
||||
'pos_x', 'pos_y', 'pos_z'])
|
||||
|
||||
print(f"打开串口 {port} @ {baud} baud ...")
|
||||
ser = serial.Serial(port, baud, timeout=1)
|
||||
ser = serial.Serial(port, baud, timeout=0.01) # 短超时, 避免 read(1) 阻塞
|
||||
|
||||
# 静止标定
|
||||
accel_bias, gyro_bias = calibrate(ser)
|
||||
@@ -135,6 +135,7 @@ def run_live(port, baud, save_csv=None):
|
||||
while plt.fignum_exists(viewer.fig.number):
|
||||
frame = read_frame(ser)
|
||||
if frame is None:
|
||||
time.sleep(0.001) # 无数据时短暂休眠, 避免忙等
|
||||
continue
|
||||
|
||||
ts = frame['timestamp_ms']
|
||||
|
||||
Reference in New Issue
Block a user