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)