From 207fc67da80d9bedde4756aa26082204d2965d99 Mon Sep 17 00:00:00 2001 From: DocGarbanzo Date: Sat, 19 Oct 2024 21:03:02 +0100 Subject: [PATCH] Only print lin accel if valid --- donkeycar/parts/imu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/donkeycar/parts/imu.py b/donkeycar/parts/imu.py index d1e5e2416..30ddef77f 100755 --- a/donkeycar/parts/imu.py +++ b/donkeycar/parts/imu.py @@ -179,13 +179,14 @@ def calibrate(self): self.pos = np.zeros(3) self.speed = np.zeros(3) tic = self.time + start_time = tic for _ in range(num_loops): self.poll() toc = time.time() if toc - tic < 1 / self.sample_rate: time.sleep(1 / self.sample_rate - (toc - tic)) tic = time.time() - self.speed_drift = self.pos / (toc - self.time) + self.speed_drift = self.pos / (toc - start_time) # reset internal parameters self.speed = np.zeros(3) self.pos = np.zeros(3)