Skip to content

Commit

Permalink
update freq from 100 -> 200
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Sep 28, 2024
1 parent d446b42 commit 341f4fa
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions donkeycar/parts/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ def __init__(self):

def calibrate(self):
logger.info('Calibrating Mpu6050 ...')
num_loops = 200
num_loops = 400
gyro = np.zeros(3)
accel = np.zeros(3)
for _ in range(num_loops):
gyro += self.mpu.gyro
accel += self.mpu.acceleration
time.sleep(0.01)
time.sleep(0.005)
self.gyro_zero = gyro / num_loops
self.accel_zero = accel / num_loops
logger.info(f'Initial acceleration: {self.accel_zero}')
Expand Down Expand Up @@ -180,7 +180,6 @@ def poll(self):
self.lin_accel = np.dot(self.matrix, accel_phys)
# remove gravity from world coordinate z-axis
self.lin_accel[2] -= self.accel_zero[2]
self.lin_accel[1] -= self.accel_zero[1]
delta_v = self.lin_accel * dt
self.speed += delta_v
self.pos += self.speed * dt
Expand Down

0 comments on commit 341f4fa

Please sign in to comment.