Skip to content

Commit 4670ab4

Browse files
authored
Merge branch 'main' into patch-1
2 parents abf9a3b + c90cebb commit 4670ab4

File tree

5 files changed

+196
-2
lines changed

5 files changed

+196
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
IMUData
2+
=======
3+
4+
IMU data message is created by the :ref:`IMU` node.
5+
6+
Reference
7+
#########
8+
9+
.. tabs::
10+
11+
.. tab:: Python
12+
13+
.. autoclass:: depthai.IMUData
14+
:members:
15+
:inherited-members:
16+
:noindex:
17+
18+
.. tab:: C++
19+
20+
.. doxygenclass:: dai::IMUData
21+
:project: depthai-core
22+
:members:
23+
:private-members:
24+
:undoc-members:
25+
26+
.. include:: ../../includes/footer-short.rst
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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

docs/source/samples/imu_accelerometer_gyroscope.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ Returns acceleration [m/s^2] and angular velocity [rad/s].
77
Demo
88
####
99

10+
Example script output
11+
12+
.. code-block::
13+
14+
~/depthai-python/examples$ python3 imu_gyroscope_accelerometer.py
15+
Accelerometer timestamp: 0.000 ms
16+
Accelerometer [m/s^2]: x: -0.162806 y: 6.445191 z: 3.189077
17+
Gyroscope timestamp: 1.642 ms
18+
Gyroscope [rad/s]: x: -0.040480 y: 0.088417 z: -0.168312
19+
Accelerometer timestamp: 2.073 ms
20+
Accelerometer [m/s^2]: x: -0.229843 y: 6.263232 z: 3.572149
21+
Gyroscope timestamp: 3.663 ms
22+
Gyroscope [rad/s]: x: -0.072438 y: 0.115049 z: -0.350472
1023
1124
Setup
1225
#####

docs/source/samples/imu_rotation_vector.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ Returns quaternion.
77
Demo
88
####
99

10+
Example script output
11+
12+
.. code-block::
13+
14+
~/depthai-python/examples$ python3 imu_rotation_vector.py
15+
Rotation vector timestamp: 0.000 ms
16+
Quaternion: i: 0.089355 j: 0.355103 k: 0.034058 real: 0.929932
17+
Accuracy (rad): 3.141602
18+
Rotation vector timestamp: 3.601 ms
19+
Quaternion: i: 0.088928 j: 0.354004 k: 0.036560 real: 0.930298
20+
Accuracy (rad): 3.141602
21+
Rotation vector timestamp: 6.231 ms
22+
Quaternion: i: 0.094604 j: 0.344543 k: 0.040955 real: 0.933105
23+
Accuracy (rad): 3.141602
1024
1125
Setup
1226
#####

docs/source/tutorials/multiple.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Example results for 2x DepthAI on a system:
4444
14442C10D13EABCE00 XLinkDeviceState.X_LINK_UNBOOTED
4545
14442C1071659ACD00 XLinkDeviceState.X_LINK_UNBOOTED
4646
47-
Selecting a Specific DepthAI device to be used.
48-
###############################################
47+
Selecting a Specific DepthAI device to be used
48+
##############################################
4949

5050
From the Detected devices(s) above, use the following code to select the device you would like to use with your pipeline.
5151
For example, if the first device is desirable from above use the following code:
@@ -66,6 +66,12 @@ You can then use the `device_info` to specify on which device you want to run yo
6666
And you can use this code as a basis for your own use cases, such that you can run differing neural models
6767
on different DepthAI/uAI models.
6868

69+
Specifying POE device to be used
70+
********************************
71+
72+
You can specify the POE device to be used by the IP address as well. Here's the `code snippet <https://docs.luxonis.com/en/latest/pages/tutorials/getting-started-with-poe/#manually-specify-device-ip>`__.
73+
74+
6975
Now use as many DepthAI devices as you need!
7076

7177
And since DepthAI does all the heavy lifting, you can usually use quite a

0 commit comments

Comments
 (0)