Skip to content

Commit e7ce238

Browse files
Merge pull request #283 from luxonis/develop
Release v2.5.0.0
2 parents 500f8e6 + 3cf54df commit e7ce238

28 files changed

+770
-55
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ pybind11_add_module(${TARGET_NAME}
8585
src/py_bindings.cpp
8686
src/XLinkConnectionBindings.cpp
8787
src/DeviceBindings.cpp
88+
src/CalibrationHandlerBindings.cpp
8889
src/DeviceBootloaderBindings.cpp
8990
src/DatatypeBindings.cpp
9091
src/DataQueueBindings.cpp

docs/conf.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ extensions = [
5050
"sphinx.ext.autosectionlabel", # https://github.com/sphinx-doc/sphinx/issues/7697 wait for this and implement
5151
"sphinx_rtd_theme",
5252
"zephyr.warnings_filter",
53+
'sphinx.ext.mathjax',
5354
]
5455

5556
# See https://github.com/sphinx-doc/sphinx/issues/7728
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
IMU Accelerometer & Gyroscope
2+
=============================
3+
4+
This example shows accelerometer and gyroscope at a combined/synchronized 500 hz rate using the onboard IMU.
5+
Returns acceleration [m/s^2] and angular velocity [rad/s].
6+
7+
Demo
8+
####
9+
10+
11+
Setup
12+
#####
13+
14+
.. include:: /includes/install_from_pypi.rst
15+
16+
Source code
17+
###########
18+
19+
.. tabs::
20+
21+
.. tab:: Python
22+
23+
Also `available on GitHub <https://github.com/luxonis/depthai-python/blob/main/examples/imu_gyroscope_accelerometer.py>`__
24+
25+
.. literalinclude:: ../../../examples/imu_gyroscope_accelerometer.py
26+
:language: python
27+
:linenos:
28+
29+
.. tab:: C++
30+
31+
Also `available on GitHub <https://github.com/luxonis/depthai-core/blob/main/examples/src/imu_gyroscope_accelerometer.cpp>`__
32+
33+
.. literalinclude:: ../../../depthai-core/examples/src/imu_gyroscope_accelerometer.cpp
34+
:language: cpp
35+
:linenos:
36+
37+
.. include:: /includes/footer-short.rst
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
IMU Rotation Vector
2+
===================
3+
4+
This example shows rotation vector output at 400 hz rate using the onboard IMU.
5+
Returns quaternion.
6+
7+
Demo
8+
####
9+
10+
11+
Setup
12+
#####
13+
14+
.. include:: /includes/install_from_pypi.rst
15+
16+
Source code
17+
###########
18+
19+
.. tabs::
20+
21+
.. tab:: Python
22+
23+
Also `available on GitHub <https://github.com/luxonis/depthai-python/blob/main/examples/imu_rotation_vector.py>`__
24+
25+
.. literalinclude:: ../../../examples/imu_rotation_vector.py
26+
:language: python
27+
:linenos:
28+
29+
.. tab:: C++
30+
31+
Also `available on GitHub <https://github.com/luxonis/depthai-core/blob/main/examples/src/imu_rotation_vector.cpp>`__
32+
33+
.. literalinclude:: ../../../depthai-core/examples/src/imu_rotation_vector.cpp
34+
:language: cpp
35+
:linenos:
36+
37+
.. include:: /includes/footer-short.rst

docs/source/tutorials/code_samples.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Code samples are used for automated testing. They are also a great starting poin
2727
- :ref:`RGB & MobileNetSSD @ 4K` - Runs MobileNetSSD on RGB frames and displays detections on both preview and 4k frames
2828
- :ref:`Mono & MobilenetSSD` - Runs MobileNetSSD on mono frames and displays detections on the frame
2929
- :ref:`Video & MobilenetSSD` - Runs MobileNetSSD on the video from the host
30+
- :ref:`IMU Accelerometer & Gyroscope` - Accelerometer and gyroscope at 500hz rate
31+
- :ref:`IMU Rotation Vector` - Rotation vector at 400 hz rate
3032

3133
.. rubric:: Complex
3234

docs/source/tutorials/simple_samples.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Simple
1919
../samples/rgb_mobilenet_4k.rst
2020
../samples/mono_mobilenet.rst
2121
../samples/video_mobilenet.rst
22+
../samples/imu_accelerometer_gyroscope.rst
23+
../samples/imu_rotation_vector.rst
24+
2225

2326
These samples are great starting point for the gen2 API.
2427

examples/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.h26*
22
*.mp4
3-
*_data
3+
*_data
4+
*.json

examples/CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ add_custom_target(install_requirements ALL
2020
COMMAND_EXPAND_LISTS
2121
)
2222

23-
# Macro for adding new python test
24-
macro(add_python_example example_name python_script_path)
23+
# Function for adding new python test
24+
function(add_python_example example_name python_script_path)
25+
# Modify example name to signify that its Python based
26+
set(example_name "py_${example_name}")
27+
2528
# parse the rest of the arguments
2629
set(arguments ${ARGV})
2730
list(REMOVE_AT arguments 0 1)
@@ -60,7 +63,7 @@ macro(add_python_example example_name python_script_path)
6063

6164
endif()
6265

63-
endmacro()
66+
endfunction()
6467

6568
if(DEPTHAI_PYTHON_TEST_EXAMPLES)
6669

@@ -119,3 +122,5 @@ add_python_example(spatial_object_tracker spatial_object_tracker.py)
119122
add_python_example(object_tracker_video object_tracker_video.py)
120123
add_python_example(stereo_depth_from_host stereo_depth_from_host.py)
121124
add_python_example(stereo_depth_video stereo_depth_video.py)
125+
add_python_example(imu_gyroscope_accelerometer imu_gyroscope_accelerometer.py)
126+
add_python_example(imu_rotation_vector imu_rotation_vector.py)

examples/calibration_flash.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
3+
from pathlib import Path
4+
import cv2
5+
import depthai as dai
6+
import argparse
7+
8+
9+
# Connect Device
10+
calibJsonFile = str((Path(__file__).parent / Path('models/depthai_calib.json')).resolve().absolute())
11+
calibBackupfile = str((Path(__file__).parent / Path('depthai_calib_backup.json')).resolve().absolute())
12+
13+
parser = argparse.ArgumentParser()
14+
parser.add_argument('calibJsonFile', nargs='?', help="Path to V6 calibration file in json", default=calibJsonFile)
15+
args = parser.parse_args()
16+
17+
with dai.Device() as device:
18+
deviceCalib = device.readCalibration()
19+
deviceCalib.eepromToJsonFile(calibBackupfile)
20+
print("Calibration Data on the device is backed up at:")
21+
print(calibBackupfile)
22+
calibData = dai.CalibrationHandler(args.calibJsonFile);
23+
status = device.flashCalibration(calibData)
24+
if status:
25+
print('Calibration write succesfull')
26+
else:
27+
print('Calibration Flash Failed!!')

0 commit comments

Comments
 (0)