Skip to content

Commit cb460d5

Browse files
committed
refactor: Format code using black
1 parent 67f9f50 commit cb460d5

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

examples/bno08x_find_heading.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from adafruit_bno08x import (
99
BNO_REPORT_STEP_COUNTER,
1010
BNO_REPORT_ROTATION_VECTOR,
11-
BNO_REPORT_GEOMAGNETIC_ROTATION_VECTOR
11+
BNO_REPORT_GEOMAGNETIC_ROTATION_VECTOR,
1212
)
1313
from adafruit_bno08x.i2c import BNO08X_I2C
1414

@@ -22,11 +22,11 @@
2222

2323

2424
def find_heading(dqw, dqx, dqy, dqz):
25-
norm = sqrt(dqw*dqw + dqx*dqx + dqy*dqy + dqz*dqz)
26-
dqw = dqw/norm
27-
dqx = dqx/norm
28-
dqy = dqy/norm
29-
dqz = dqz/norm
25+
norm = sqrt(dqw * dqw + dqx * dqx + dqy * dqy + dqz * dqz)
26+
dqw = dqw / norm
27+
dqx = dqx / norm
28+
dqy = dqy / norm
29+
dqz = dqz / norm
3030

3131
ysqr = dqy * dqy
3232

@@ -49,8 +49,7 @@ def find_heading(dqw, dqx, dqy, dqz):
4949
# the geomagnetic sensor is unstable
5050
# Heading is calculated using geomagnetic vector
5151
geo_quat_i, geo_quat_j, geo_quat_k, geo_quat_real = bno.geomagnetic_quaternion
52-
heading_geo = find_heading(
53-
geo_quat_real, geo_quat_i, geo_quat_j, geo_quat_k)
52+
heading_geo = find_heading(geo_quat_real, geo_quat_i, geo_quat_j, geo_quat_k)
5453
print("Heading using geomagnetic rotation vector:", heading_geo)
5554
print("")
5655
time.sleep(0.1)

0 commit comments

Comments
 (0)