Skip to content

Commit

Permalink
move imufusion into imu part
Browse files Browse the repository at this point in the history
  • Loading branch information
DocGarbanzo committed Sep 27, 2024
1 parent 944dc66 commit c2a49d6
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions donkeycar/parts/imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ def __init__(self):
self.speed = np.zeros(3)
self.time = None
self.path = [] # [(self.time, *self.pos)]
self.sample_rate = 100
self.ahrs = imufusion.Ahrs()
self.ahrs.settings = imufusion.Settings(
# imufusion.CONVENTION_NWU,
imufusion.CONVENTION_ENU,
0.5, # gain
2000, # gyroscope range
10, # acceleration rejection
10, # magnetic rejection
5 * self.sample_rate, # recovery trigger period = 5 seconds
)
self.offset = imufusion.Offset(self.sample_rate)
self.matrix = None
self.euler = None
self.calibrate()
# self.sample_rate = 100
# self.ahrs = imufusion.Ahrs()
# self.ahrs.settings = imufusion.Settings(
# # imufusion.CONVENTION_NWU,
# imufusion.CONVENTION_ENU,
# 0.5, # gain
# 2000, # gyroscope range
# 10, # acceleration rejection
# 10, # magnetic rejection
# 5 * self.sample_rate, # recovery trigger period = 5 seconds
# )
# self.offset = imufusion.Offset(self.sample_rate)
# self.matrix = None
# self.euler = None
# self.calibrate()

def calibrate(self):
logger.info("Calibrating IMU ...")
Expand Down Expand Up @@ -200,10 +200,10 @@ def shutdown(self):
while True:
try:
matrix = p.run()
out_str = f"\reuler: " + f",".join(f"{x:+5.3f}" for x in matrix)
#out_str = f"\reuler: " + f",".join(f"{x:+5.3f}" for x in matrix)
#out_str = f"\rm = {matrix}"
stdout.write(out_str)
stdout.flush()
#stdout.write(out_str)
# stdout.flush()
time.sleep(0.01)
count += 1
except KeyboardInterrupt:
Expand Down

0 comments on commit c2a49d6

Please sign in to comment.