Skip to content

Commit

Permalink
speed drift
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Oct 1, 2024
1 parent 658ac0e commit 5196daa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions donkeycar/parts/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def calibrate(self):
self.poll()
time.sleep(0.006)
now = time.time()
self.speed_drift = 0 # self.speed / (now - self.time)
self.speed_drift = self.speed / (now - self.time) / 9.81
# reset internal parameters
self.speed = np.zeros(3)
self.pos = np.zeros(3)
Expand Down Expand Up @@ -204,7 +204,7 @@ def poll(self):
accel_ignore = self.ahrs.internal_states.accelerometer_ignored
if not accel_ignore:
delta_v = self.lin_accel * dt
self.speed += 0.5 * delta_v
self.speed += delta_v
self.pos += (self.speed - self.speed_drift) * dt
self.path.append((self.time, *self.pos, np.linalg.norm(self.speed)))
self.time = new_time
Expand Down

0 comments on commit 5196daa

Please sign in to comment.