Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use euler as a compass heading #99

Closed
KingFuGitHub opened this issue Mar 19, 2022 · 3 comments
Closed

How to use euler as a compass heading #99

KingFuGitHub opened this issue Mar 19, 2022 · 3 comments
Labels

Comments

@KingFuGitHub
Copy link

Currently the euler acts like a heading when it's turned on facing north. I wonder how I could make it so the sensor.euler[0] acts like a compass heading when not facing north originally when the IMU turned on. Thank you in advance.

@tekktrik
Copy link
Member

tekktrik commented Mar 21, 2022

A brief look at the data sheet doesn't show a way to tell the sensor to compensate for the difference. But you could always do it yourself if you know the angle!

import time
import board
import adafruit_bno055

i2c = board.I2C()
sensor = adafruit_bno055.BNO055_I2C(i2c)

heading_offset = 22.1  # offset of 22.1 degrees

while True:
    print("Heading based on power on: {}".format(sensor.euler[0]))
    print("Compass heading (offset based): {}".format(sensor.euler[0] + heading_offset))
    time.sleep(1)

@KingFuGitHub
Copy link
Author

That would be hard coding it because the offset isn't always the same due to the initial boot up orientation being different every time the IMU is powered on.

@tekktrik
Copy link
Member

tekktrik commented Apr 2, 2022

Duplicate of #100

@tekktrik tekktrik marked this as a duplicate of #100 Apr 2, 2022
@tekktrik tekktrik closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants