|
| 1 | +IMU |
| 2 | +=== |
| 3 | + |
| 4 | +IMU (`intertial measurement unit <https://en.wikipedia.org/wiki/Inertial_measurement_unit>`__) node can be used to receive data from the IMU chip on the device. |
| 5 | +Our DepthAI devices use `BNO085 <https://www.ceva-dsp.com/product/bno080-085/>`__ 9-axis sensor (`datasheet here <https://www.ceva-dsp.com/wp-content/uploads/2019/10/BNO080_085-Datasheet.pdf>`__) |
| 6 | +that supports sensor fusion on the (IMU) chip itself. The IMU chip is connected to the Myriad X (VPU) over SPI (we have integrated |
| 7 | +`this driver <https://github.com/hcrest/bno080-driver>`__ to the DepthAI). |
| 8 | + |
| 9 | + |
| 10 | +How to place it |
| 11 | +############### |
| 12 | + |
| 13 | +.. tabs:: |
| 14 | + |
| 15 | + .. code-tab:: py |
| 16 | + |
| 17 | + pipeline = dai.Pipeline() |
| 18 | + imu = pipeline.create(dai.node.IMU) |
| 19 | + |
| 20 | + .. code-tab:: c++ |
| 21 | + |
| 22 | + dai::Pipeline pipeline; |
| 23 | + auto imu = pipeline.create<dai::node::IMU>(); |
| 24 | + |
| 25 | + |
| 26 | +Inputs and Outputs |
| 27 | +################## |
| 28 | + |
| 29 | +.. code-block:: |
| 30 | +
|
| 31 | + ┌──────────────┐ |
| 32 | + │ │ |
| 33 | + │ │ out |
| 34 | + │ IMU ├─────────► |
| 35 | + │ │ |
| 36 | + │ │ |
| 37 | + └──────────────┘ |
| 38 | +
|
| 39 | +**Message types** |
| 40 | + |
| 41 | +- :code:`out` - :ref:`IMUData` |
| 42 | + |
| 43 | +Maximum frequencies |
| 44 | +################### |
| 45 | + |
| 46 | +Maximum output frequencies are 500 Hz raw accelerometer, 1000 Hz raw gyroscope values individually, and 500 Hz combined (synced) output. |
| 47 | +You can obtain the combined (synced) 500 Hz output with :code:`imu.enableIMUSensor([dai.IMUSensor.RAW_ACCELEROMETER, dai.IMUSensor.RAW_GYROSCOPE], 500)`. |
| 48 | + |
| 49 | +Usage |
| 50 | +##### |
| 51 | + |
| 52 | +.. tabs:: |
| 53 | + |
| 54 | + .. code-tab:: py |
| 55 | + |
| 56 | + pipeline = dai.Pipeline() |
| 57 | + imu = pipeline.create(dai.node.IMU) |
| 58 | + |
| 59 | + # enable RAW_ACCELEROMETER and RAW_GYROSCOPE at 100 hz rate |
| 60 | + imu.enableIMUSensor([dai.IMUSensor.RAW_ACCELEROMETER, dai.IMUSensor.RAW_GYROSCOPE], 100) |
| 61 | + # above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available |
| 62 | + imu.setBatchReportThreshold(1) |
| 63 | + # maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it |
| 64 | + # if lower or equal to batchReportThreshold then the sending is always blocking on device |
| 65 | + # useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes |
| 66 | + imu.setMaxBatchReports(10) |
| 67 | + |
| 68 | + .. code-tab:: c++ |
| 69 | + |
| 70 | + dai::Pipeline pipeline; |
| 71 | + auto imu = pipeline.create<dai::node::IMU>(); |
| 72 | + |
| 73 | + // enable RAW_ACCELEROMETER and RAW_GYROSCOPE at 100 hz rate |
| 74 | + imu->enableIMUSensor({dai::IMUSensor::RAW_ACCELEROMETER, dai::IMUSensor::RAW_GYROSCOPE}, 100); |
| 75 | + // above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available |
| 76 | + imu->setBatchReportThreshold(1); |
| 77 | + // maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it |
| 78 | + // if lower or equal to batchReportThreshold then the sending is always blocking on device |
| 79 | + // useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes |
| 80 | + imu->setMaxBatchReports(10); |
| 81 | + |
| 82 | + |
| 83 | +IMU sensors |
| 84 | +########### |
| 85 | + |
| 86 | +When enabling the IMU sensors (:code:`imu.enableIMUSensor()`), you can select between the following sensors: |
| 87 | + |
| 88 | +- :code:`ACCELEROMETER_RAW` |
| 89 | +- :code:`ACCELEROMETER` |
| 90 | +- :code:`LINEAR_ACCELERATION` |
| 91 | +- :code:`GRAVITY` |
| 92 | +- :code:`GYROSCOPE_RAW` |
| 93 | +- :code:`GYROSCOPE_CALIBRATED` |
| 94 | +- :code:`GYROSCOPE_UNCALIBRATED` |
| 95 | +- :code:`MAGNETOMETER_RAW` |
| 96 | +- :code:`MAGNETOMETER_CALIBRATED` |
| 97 | +- :code:`MAGNETOMETER_UNCALIBRATED` |
| 98 | +- :code:`ROTATION_VECTOR` |
| 99 | +- :code:`GAME_ROTATION_VECTOR` |
| 100 | +- :code:`GEOMAGNETIC_ROTATION_VECTOR` |
| 101 | +- :code:`ARVR_STABILIZED_ROTATION_VECTOR` |
| 102 | +- :code:`ARVR_STABILIZED_GAME_ROTATION_VECTOR` |
| 103 | + |
| 104 | +Here are **descriptions of all sensors**: |
| 105 | + |
| 106 | +.. autoclass:: depthai.IMUSensor |
| 107 | + :noindex: |
| 108 | + |
| 109 | +Examples of functionality |
| 110 | +######################### |
| 111 | + |
| 112 | +- :ref:`IMU Accelerometer & Gyroscope` |
| 113 | +- :ref:`IMU Rotation Vector` |
| 114 | + |
| 115 | +Reference |
| 116 | +######### |
| 117 | + |
| 118 | +.. tabs:: |
| 119 | + |
| 120 | + .. tab:: Python |
| 121 | + |
| 122 | + .. autoclass:: depthai.node.IMU |
| 123 | + :members: |
| 124 | + :inherited-members: |
| 125 | + :noindex: |
| 126 | + |
| 127 | + .. tab:: C++ |
| 128 | + |
| 129 | + .. doxygenclass:: dai::node::IMU |
| 130 | + :project: depthai-core |
| 131 | + :members: |
| 132 | + :private-members: |
| 133 | + :undoc-members: |
| 134 | + |
| 135 | +.. include:: ../../includes/footer-short.rst |
0 commit comments