Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed which modes should provide which outputs
  • Loading branch information
ViennaMike committed Apr 2, 2021
commit 21b930cb9aa39b5ff901ec44156a36d0a3920160
71 changes: 36 additions & 35 deletions adafruit_bno055.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,37 +186,38 @@ def _reset(self):
@property
def mode(self):
"""
legend: x=on, -=off

+------------------+-------+---------+------+----------+
| Mode | Accel | Compass | Gyro | Absolute |
+==================+=======+=========+======+==========+
| CONFIG_MODE | - | - | - | - |
+------------------+-------+---------+------+----------+
| ACCONLY_MODE | X | - | - | - |
+------------------+-------+---------+------+----------+
| MAGONLY_MODE | - | X | - | - |
+------------------+-------+---------+------+----------+
| GYRONLY_MODE | - | - | X | - |
+------------------+-------+---------+------+----------+
| ACCMAG_MODE | X | X | - | - |
+------------------+-------+---------+------+----------+
| ACCGYRO_MODE | X | - | X | - |
+------------------+-------+---------+------+----------+
| MAGGYRO_MODE | - | X | X | - |
+------------------+-------+---------+------+----------+
| AMG_MODE | X | X | X | - |
+------------------+-------+---------+------+----------+
| IMUPLUS_MODE | X | - | X | - |
+------------------+-------+---------+------+----------+
| COMPASS_MODE | X | X | - | X |
+------------------+-------+---------+------+----------+
| M4G_MODE | X | X | - | - |
+------------------+-------+---------+------+----------+
| NDOF_FMC_OFF_MODE| X | X | X | X |
+------------------+-------+---------+------+----------+
| NDOF_MODE | X | X | X | X |
+------------------+-------+---------+------+----------+
legend: x=on, -=off (see Table 3-3 in datasheet)

+------------------+-------+---------+------+----------+----------+
| Mode | Accel | Compass | Gyro | Fusion | Fusion |
| | | (Mag) | | Absolute | Relative |
+==================+=======+=========+======+==========+==========+
| CONFIG_MODE | - | - | - | - | - |
+------------------+-------+---------+------+----------+----------+
| ACCONLY_MODE | X | - | - | - | - |
+------------------+-------+---------+------+----------+----------+
| MAGONLY_MODE | - | X | - | - | - |
+------------------+-------+---------+------+----------+----------+
| GYRONLY_MODE | - | - | X | - | - |
+------------------+-------+---------+------+----------+----------+
| ACCMAG_MODE | X | X | - | - | - |
+------------------+-------+---------+------+----------+----------+
| ACCGYRO_MODE | X | - | X | - | - |
+------------------+-------+---------+------+----------+----------+
| MAGGYRO_MODE | - | X | X | - | - |
+------------------+-------+---------+------+----------+----------+
| AMG_MODE | X | X | X | - | - |
+------------------+-------+---------+------+----------+----------+
| IMUPLUS_MODE | X | - | X | - | X |
+------------------+-------+---------+------+----------+----------+
| COMPASS_MODE | X | X | - | X | - |
+------------------+-------+---------+------+----------+----------+
| M4G_MODE | X | X | - | - | X |
+------------------+-------+---------+------+----------+----------+
| NDOF_FMC_OFF_MODE| X | X | X | X | - |
+------------------+-------+---------+------+----------+----------+
| NDOF_MODE | X | X | X | X | - |
+------------------+-------+---------+------+----------+----------+

The default mode is ``NDOF_MODE``.

Expand Down Expand Up @@ -388,7 +389,7 @@ def euler(self):
"""Gives the calculated orientation angles, in degrees.
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
"""
if self.mode in [0x09, 0x0B, 0x0C, 0x08, 0x0A]:
if self.mode in [0x08, 0x09, 0x0A, 0x0B, 0x0C]:
return self._euler
return (None, None, None)

Expand All @@ -401,7 +402,7 @@ def quaternion(self):
"""Gives the calculated orientation as a quaternion.
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
"""
if self.mode in [0x09, 0x0B, 0x0C, 0x08, 0x0A]:
if self.mode in [0x08, 0x09, 0x0A, 0x0B, 0x0C]:
return self._quaternion
return (None, None, None, None)

Expand All @@ -414,7 +415,7 @@ def linear_acceleration(self):
"""Returns the linear acceleration, without gravity, in m/s.
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
"""
if self.mode in [0x09, 0x0B, 0x0C]:
if self.mode in [0x08, 0x09, 0x0A, 0x0B, 0x0C]:
return self._linear_acceleration
return (None, None, None)

Expand All @@ -427,7 +428,7 @@ def gravity(self):
"""Returns the gravity vector, without acceleration in m/s.
Returns an empty tuple of length 3 when this property has been disabled by the current mode.
"""
if self.mode in [0x09, 0x0B, 0x0C]:
if self.mode in [0x08, 0x09, 0x0A, 0x0B, 0x0C]:
return self._gravity
return (None, None, None)

Expand Down