Skip to content

Commit a5774f0

Browse files
Merge pull request #214 from luxonis/develop_main_merge
Develop-main merge
2 parents 54b82d8 + 099a07b commit a5774f0

File tree

60 files changed

+382
-301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+382
-301
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ _builds/
2525

2626
#git
2727
*.orig
28+
*_REMOTE_*
29+
*_LOCAL_*
30+
*_BACKUP_*
31+
*_BASE_*
2832

2933
#ci
3034
wheelhouse/

README.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,6 @@ Python bindings for C++ depthai-core library
1010

1111
Documentation is available over at [Luxonis DepthAI API](https://docs.luxonis.com/projects/api/en/latest/)
1212

13-
### Building documentation
14-
15-
- **Using [Docker](https://docs.docker.com/) (with [Docker Compose](https://docs.docker.com/compose/install/))**
16-
17-
```
18-
cd docs
19-
docker-compose build
20-
docker-compose up
21-
```
22-
23-
Then open [http://localhost:8000](http://localhost:8000).
24-
25-
This docker container will watch changes in the `docs/source` directory and rebuild the docs automatically
26-
27-
- **Linux**
28-
29-
First, please install the required [dependencies](#Dependencies)
30-
31-
Then run the following commands to build the docs website
32-
33-
```
34-
python3 -m pip install -U pip
35-
python3 -m pip install -r docs/requirements.txt
36-
cmake -S . -B build -D DEPTHAI_BUILD_DOCS=ON -D DEPTHAI_PYTHON_BUILD_DOCS=ON
37-
cmake --build build --target sphinx --parallel
38-
python3 -m http.server --bind 0.0.0.0 8000 --directory build/docs/sphinx
39-
```
40-
41-
Then open [http://localhost:8000](http://localhost:8000).
42-
43-
This will build documentation based on current sources, so if some new changes will be made, run this command
44-
in a new terminal window to update the website source
45-
46-
```
47-
cmake --build build --target sphinx --parallel
48-
```
49-
50-
Then refresh your page - it should load the updated website that was just built
51-
52-
5313
## Installation
5414

5515
Prebuilt wheels are available in [Luxonis repository](https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/)
@@ -110,6 +70,46 @@ ctest
11070
- Raspbian 10;
11171
- macOS 10.14.6, 10.15.4;
11272

73+
### Building documentation
74+
75+
- **Using [Docker](https://docs.docker.com/) (with [Docker Compose](https://docs.docker.com/compose/install/))**
76+
77+
```
78+
cd docs
79+
sudo docker-compose build
80+
sudo docker-compose up
81+
```
82+
83+
> ℹ️ You can leave out the `sudo` if you have added your user to the `docker` group (or are using rootless docker).
84+
Then open [http://localhost:8000](http://localhost:8000).
85+
86+
This docker container will watch changes in the `docs/source` directory and rebuild the docs automatically
87+
88+
- **Linux**
89+
90+
First, please install the required [dependencies](#Dependencies)
91+
92+
Then run the following commands to build the docs website
93+
94+
```
95+
python3 -m pip install -U pip
96+
python3 -m pip install -r docs/requirements.txt
97+
cmake -S . -B build -D DEPTHAI_BUILD_DOCS=ON -D DEPTHAI_PYTHON_BUILD_DOCS=ON
98+
cmake --build build --parallel --target sphinx
99+
python3 -m http.server --bind 0.0.0.0 8000 --directory build/docs/sphinx
100+
```
101+
102+
Then open [http://localhost:8000](http://localhost:8000).
103+
104+
This will build documentation based on current sources, so if some new changes will be made, run this command
105+
in a new terminal window to update the website source
106+
107+
```
108+
cmake --build build --parallel --target sphinx
109+
```
110+
111+
Then refresh your page - it should load the updated website that was just built
112+
113113
## Troubleshooting
114114
115115
### Relocation link error
@@ -121,7 +121,7 @@ Build failure on Ubuntu 18.04 ("relocation ..." link error) with gcc 7.4.0 (defa
121121
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 70
122122
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 70
123123
### Hunter
124-
Hunter is a CMake-only dependency manager for C/C++ projects.
124+
Hunter is a CMake-only dependency manager for C/C++ projects.
125125
126126
If you are stuck with error message which mentions external libraries (subdirectory of `.hunter`) like the following:
127127
```
@@ -145,7 +145,7 @@ del C:/[user]/.hunter
145145
146146
### LTO - link time optimization
147147
148-
If following message appears:
148+
If following message appears:
149149
```
150150
lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:152
151151
Please submit a full bug report,

depthai-core

docs/conf.py.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ html_static_path = ['_static']
8282
html_favicon = '_static/images/favicon.png'
8383
html_css_files = [
8484
'css/index.css',
85-
'https://docs.luxonis.com/en/gen2/_static/css/navbar.css',
85+
'https://docs.luxonis.com/en/latest/_static/css/navbar.css',
8686
]
8787
html_js_files = [
88-
'https://docs.luxonis.com/en/gen2/_static/js/navbar.js',
88+
'https://docs.luxonis.com/en/latest/_static/js/navbar.js',
8989
]
9090
html_title = 'DepthAI documentation | Luxonis'
9191

92-
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
92+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}

docs/docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
version: "3"
12
services:
23
docs:
34
build:

docs/source/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ Now, pick a tutorial or code sample and start utilizing Gen2 capabilities
9292
samples/16_device_queue_event.rst
9393
samples/17_video_mobilenet.rst
9494
samples/18_rgb_encoding_mobilenet.rst
95+
samples/19_mono_camera_control.rst
96+
samples/20_color_rotate_warp.rst
9597
samples/22_1_tiny_yolo_v3_decoding_on_device.rst
9698
samples/22_2_tiny_yolo_v4_decoding_on_device.rst
9799
samples/23_autoexposure_roi.rst

docs/source/install.rst

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ Supported Platforms
1616

1717
We keep up-to-date, pre-compiled, libraries for the following platforms. Note that a new change is that for Ubuntu now also work unchanged for the Jetson/Xavier series:
1818

19-
======================== =========================================== ================================================= ================================================================================
20-
Platform Instructions Tutorial Support
21-
======================== =========================================== ================================================= ================================================================================
22-
Windows 10 :ref:`Platform dependencies <Windows>` `Video tutorial <https://youtu.be/ekopKJfcWiE>`__ `Discord <https://discord.com/channels/790680891252932659/798284448323731456>`__
23-
macOS :ref:`Platform dependencies <macOS>` `Video tutorial <https://youtu.be/0RGmmjed3Hc>`__ `Discord <https://discord.com/channels/790680891252932659/798283911989690368>`__
24-
Ubuntu & Jetson/Xavier :ref:`Platform dependencies <Ubuntu>` `Video tutorial <https://youtu.be/QXeXMaxj4cM>`__ `Discord <https://discord.com/channels/790680891252932659/798302162160451594>`__
25-
Raspberry Pi :ref:`Platform dependencies <Raspberry Pi>` `Video tutorial <https://youtu.be/BpUMT-xqwqE>`__ `Discord <https://discord.com/channels/790680891252932659/798302708070350859>`__
26-
======================== =========================================== ================================================= ================================================================================
19+
======================== ============================================== ================================================================================
20+
Platform Instructions Support
21+
======================== ============================================== ================================================================================
22+
Windows 10 :ref:`Platform dependencies <Windows>` `Discord <https://discord.com/channels/790680891252932659/798284448323731456>`__
23+
macOS :ref:`Platform dependencies <macOS>` `Discord <https://discord.com/channels/790680891252932659/798283911989690368>`__
24+
Ubuntu & Jetson/Xavier :ref:`Platform dependencies <Ubuntu>` `Discord <https://discord.com/channels/790680891252932659/798302162160451594>`__
25+
Raspberry Pi OS :ref:`Platform dependencies <Raspberry Pi OS>` `Discord <https://discord.com/channels/790680891252932659/798302708070350859>`__
26+
======================== ============================================== ================================================================================
2727

2828
And the following platforms are also supported by a combination of the community and Luxonis.
2929

@@ -34,6 +34,7 @@ Fedora `Di
3434
Robot Operating System `Discord <https://discord.com/channels/790680891252932659/795749142793420861>`__
3535
Windows 7 :ref:`WinUSB driver <Windows 7>` `Discord <https://discord.com/channels/790680891252932659/798284448323731456>`__
3636
Docker :ref:`Pull and run official images <Docker>` `Discord <https://discord.com/channels/790680891252932659/796794747275837520>`__
37+
Kernel Virtual Machine :ref:`Run on KVM <KVM>` `Discord <https://discord.com/channels/790680891252932659/819663531003346994>`__
3738
====================== ===================================================== ================================================================================
3839

3940
macOS
@@ -147,6 +148,68 @@ Run the :code:`01_rgb_preview.py` example inside a Docker container on a Linux h
147148
To allow the container to update X11 you may need to run :code:`xhost local:root` on
148149
the host.
149150

151+
KVM
152+
***
153+
154+
To access the OAK-D camera in the `Kernel Virtual Machine <https://www.linux-kvm.org/page/Main_Page>`__, there is a need to attach and detach USB
155+
devices on the fly when the host machine detects changes in the USB bus.
156+
157+
OAK-D camera changes the USB device type when it is used by DepthAI API. This happens in backgound when the camera is used natively.
158+
But when the camera is used in a virtual environment the situation is different.
159+
160+
On your host machine, use the following code:
161+
162+
.. code-block:: bash
163+
164+
SUBSYSTEM=="usb", ACTION=="bind", ENV{ID_VENDOR_ID}=="03e7", MODE="0666", RUN+="/usr/local/bin/movidius_usb_hotplug.sh depthai-vm"
165+
SUBSYSTEM=="usb", ACTION=="remove", ENV{PRODUCT}=="3e7/2485/1", ENV{DEVTYPE}=="usb_device", MODE="0666", RUN+="/usr/local/bin/movidius_usb_hotplug.sh depthai-vm"
166+
SUBSYSTEM=="usb", ACTION=="remove", ENV{PRODUCT}=="3e7/f63b/100", ENV{DEVTYPE}=="usb_device", MODE="0666", RUN+="/usr/local/bin/movidius_usb_hotplug.sh depthai-vm"
167+
168+
The script that the udev rule is calling (movidius_usb_hotplug.sh) should then attach/detach the USB device to the virtual machine.
169+
In this case we need to call :code:`virsh` command. For example, the script could do the following:
170+
171+
.. code-block:: bash
172+
173+
#!/bin/bash
174+
# Abort script execution on errors
175+
set -e
176+
if [ "${ACTION}" == 'bind' ]; then
177+
COMMAND='attach-device'
178+
elif [ "${ACTION}" == 'remove' ]; then
179+
COMMAND='detach-device'
180+
if [ "${PRODUCT}" == '3e7/2485/1' ]; then
181+
ID_VENDOR_ID=03e7
182+
ID_MODEL_ID=2485
183+
fi
184+
if [ "${PRODUCT}" == '3e7/f63b/100' ]; then
185+
ID_VENDOR_ID=03e7
186+
ID_MODEL_ID=f63b
187+
fi
188+
else
189+
echo "Invalid udev ACTION: ${ACTION}" >&2
190+
exit 1
191+
fi
192+
echo "Running virsh ${COMMAND} ${DOMAIN} for ${ID_VENDOR}." >&2
193+
virsh "${COMMAND}" "${DOMAIN}" /dev/stdin <<END
194+
<hostdev mode='subsystem' type='usb'>
195+
<source>
196+
<vendor id='0x${ID_VENDOR_ID}'/>
197+
<product id='0x${ID_MODEL_ID}'/>
198+
</source>
199+
</hostdev>
200+
END
201+
exit 0
202+
203+
204+
Note that when the device is disconnected from the USB bus, some udev environmental variables are not available (:code:`ID_VENDOR_ID` or :code:`ID_MODEL_ID`),
205+
that is why you need to use :code:`PRODUCT` environmental variable to identify which device has been disconnected.
206+
207+
The virtual machine where DepthAI API application is running should have defined a udev rules that identify the OAK-D camera.
208+
The udev rule is decribed `here <https://docs.luxonis.com/en/latest/pages/faq/#does-depthai-work-on-the-nvidia-jetson-series>`__
209+
210+
Solution provided by `Manuel Segarra-Abad <https://github.com/maseabunikie>`__
211+
212+
150213
Install from PyPI
151214
#################
152215

docs/source/samples/04_rgb_encoding.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ encoded video over XLINK to the host, saving it to disk as a video file.
99
Pressing Ctrl+C will stop the recording and then convert it using ffmpeg into an mp4 to make it
1010
playable. Note that ffmpeg will need to be installed and runnable for the conversion to mp4 to succeed.
1111

12-
Be careful, this example saves encoded video to your host storage. So if you leave them running,
12+
Be careful, this example saves encoded video to your host storage. So if you leave it running,
1313
you could fill up your storage on your host.
1414

1515

docs/source/samples/05_rgb_mono_encoding.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ each, all at 30FPS. Each encoded video stream is transferred over XLINK and save
88
Pressing Ctrl+C will stop the recording and then convert it using ffmpeg into an mp4 to make it
99
playable. Note that ffmpeg will need to be installed and runnable for the conversion to mp4 to succeed.
1010

11-
Be careful, this example saves encoded video to your host storage. So if you leave them running,
11+
Be careful, this example saves encoded video to your host storage. So if you leave it running,
1212
you could fill up your storage on your host.
1313

1414
Demo

docs/source/samples/06_rgb_full_resolution_saver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ uncompressed frames, processed by ISP, and raw - BayerRG (R_Gr_Gb_B), as read fr
88
10-bit packed. See here for the pull request on this capability.
99

1010
Be careful, this example saves full resolution .png pictures to your host storage. So if you leave
11-
them running, you could fill up your storage on your host.
11+
it running, you could fill up your storage on your host.
1212

1313
Demo
1414
####

0 commit comments

Comments
 (0)