Skip to content

Commit

Permalink
Only print lin accel if valid
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Oct 19, 2024
1 parent 7e1dd51 commit 207fc67
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion donkeycar/parts/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 207fc67

Please sign in to comment.