Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
themarpe committed Jun 1, 2022
2 parents 2c6da14 + cd39f40 commit 5ee238c
Show file tree
Hide file tree
Showing 16 changed files with 240 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ endif()

# Pybindings project
set(TARGET_NAME depthai)
project(depthai VERSION "0") # revision of bindings [depthai-core].[rev]
project(depthai VERSION "1") # revision of bindings [depthai-core].[rev]

# Set default build type depending on context
set(default_build_type "Release")
Expand Down
2 changes: 1 addition & 1 deletion depthai-core
57 changes: 49 additions & 8 deletions docs/source/components/bootloader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,59 @@
Bootloader
==========

Depthai bootloader is a small program which aids in booting and updating bootloader or depthai application packages.
DepthAI bootloader is a small program which **handles the booting process**, either by **booting the flashed application**,
or by **initializing the OAK PoE camera** so DepthAI API can connect to it.

To be able to run standalone (:ref:`documentation here <Standalone mode>`), the Depthai bootloader must be first
flashed to the devices flash. This step is required only once.
To be able to run in :ref:`Standalone mode`, the Depthai bootloader must be first flashed to the devices flash.
This step is required only once.

Once the device has the bootloader flashed, it will perform the same as before. Running pipelines with a host
connected doesnt require any changes.
connected doesn't require any changes.

Suggested workflow is to perform as much of development as possible with the host connected as the
iteration cycle is greatly improved.

Once desired pipeline is created, use the following function to flash: :code:`DeviceBootloader::flash`
Device Manager
##############

``device_manager.py`` is a Python helper that interfaces with device :ref:`Bootloader` and bootloader configuration.
It can be found at `depthai-python/utilities <https://github.com/luxonis/depthai-python/tree/main/utilities>`__.

.. image:: https://user-images.githubusercontent.com/18037362/170479657-faacd06d-5f7e-4215-a821-005d58a5f379.png

Device Manager Usage
--------------------

**About device tab** - Select a camera to see its metadata - like MxID, flashed bootloader version, device state etc.

* First, we need to select the device using the dropdown. You can click ``Search`` to search for all available cameras, either via USB port or on LAN (PoE OAKs).
* ``Flash newest Bootloader`` button will flash the ``newest bootloader`` to the device. You can select AUTO, USB or NETWORK bootloader.

* **AUTO** will select the connection type of bootloader with which the camera is currently connected to. If you are connected via USB (doing factory reset) to an OAK PoE camera, you shouldn't select AUTO, as it will flash USB bootloader.
* **USB** bootloader will try to boot the application that is stored on flash memory. If it can't find flashed application, it will just behave as normal USB OAK - so it will wait until a host computer initializes the application.
* **NETWORK** bootloader is used by the OAK PoE cameras, and is flashed at the factory. It handles network initialization so the OAK PoE cameras can be booted through the LAN.

* ``Factory reset`` will erase the whole flash content and re-flash it with only the USB or NETWORK bootloader. Flashed application (pipeline, assets) and bootloader configurations will be lost.
* ``Boot into USB recovery mode`` will force eg. OAK PoE camera to be available through the USB connector, even if its boot pins are set to PoE booting. It is mostly used by our firmware developers.

**Configuration settings tab** - After you select a device that has bootloader flashed, you can also configure bootloader
configuration.

- If the device has **NETWORK bootloader flashed**, you will be able to set its static/dynamic IP/mask/gateway, DNS, MAC, etc.
- If the device has **USB bootloader flashed**, you will be able to set its USB max speed and USB timeout.

After setting some values, you have to click on the ``Flash configuration`` button. You can also flash a :ref:`DAP`,
or clear the bootloader config.

Boot switches
#############

- **Boot from flash** - DIP switch: 0x03 (switches 5,6 ON) - used by OAK PoE and USB cameras when bootloader is installed.
- **Recovery mode for USB** - DIP switch: 0x16 (switches 2,4,5 ON) - to boot directly into USB mode, so camera waits for the host to connect to it via USB.

.. image:: https://user-images.githubusercontent.com/18037362/154956812-c3fcc961-af46-4dfd-8080-e15c8c6b43f0.png

OAK-D-PoE with switches 2,4,5 ON, for the purpose of connecting to the device via USB.

API
###
Expand All @@ -33,15 +74,15 @@ or update the bootloader itself.
progressCb parameter takes a callback function, which will be called each time an progress update occurs (rate limited to 1 second). This is mainly
used to inform the user of the current flashing progress.

You can also check the version of the current bootloader by using the :ref:`Bootloader Version` example.
.. _DAP:

DepthAI Application Package (.dap)
##################################

Depthai application package is a binary file format which stores sections of data. The purpose of this format is to be able to extract
**DepthAI application package** is a binary file format which stores sections of data. The purpose of this format is to be able to extract
individual sections and do OTA updates without requiring to update all data. Example: Between update 1 and 2 of users application,
Depthai firmware, Asset storage (50MiB neural network) and asset structure remained the same, but some additional processing nodes were added
to the pipeline. Instead of transferring the whole package only Pipeline description can be sent and updated.
to the pipeline. Instead of transferring the whole package, only Pipeline description can be sent and updated.

Depthai application package (**.dap**) consists of:

Expand Down
11 changes: 10 additions & 1 deletion docs/source/components/nodes/color_camera.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ Click `here <https://en.wikipedia.org/wiki/Image_processor>`__ for more informat

**Image Post-Processing** converts YUV420 planar frames from the **ISP** into :code:`video`/:code:`preview`/:code:`still` frames.

When setting sensor resolution to 12MP and using :code:`video`, you will get 4K video output. 4K frames are cropped from 12MP frames (not downsampled).
``still`` (when a capture is triggered) and ``isp`` work at the max camera resolution, while ``video`` and ``preview`` are
limited to max 4K (3840 x 2160) resolution, which is cropped from ``isp``.
For IMX378 (12MP), the **post-processing** works like this:

.. code-block::
┌─────┐ Cropping to ┌─────────┐ Downscaling ┌──────────┐
│ ISP ├────────────────►│ video ├───────────────►│ preview │
└─────┘ max 3840x2160 └─────────┘ and cropping └──────────┘
Usage
#####
Expand Down Expand Up @@ -93,6 +101,7 @@ Here are known camera limitations for the Myriad X:

- **ISP can process about 600 MP/s**, and about **500 MP/s** when the pipeline is also running NNs and video encoder in parallel
- **3A algorithms** can process about **200..250 FPS overall** (for all camera streams). This is a current limitation of our implementation, and we have plans for a workaround to run 3A algorithms on every Xth frame, no ETA yet
- **ISP Scaling** numerator value can be 1..16 and denominator value 1..32 for both vertical and horizontal scaling. So you can downscale eg. 12MP (4056x3040) only to resolutions `calculated here <https://docs.google.com/spreadsheets/d/153yTstShkJqsPbkPOQjsVRmM8ZO3A6sCqm7uayGF-EE/edit#gid=0>`__

Examples of functionality
#########################
Expand Down
2 changes: 0 additions & 2 deletions docs/source/components/nodes/imu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ IMU devices
List of devices that have an IMU sensor on-board:

* `OAK-D <https://docs.luxonis.com/projects/hardware/en/latest/pages/BW1098OAK.html>`__
* `OAK-D-IoT-40 <https://docs.luxonis.com/projects/hardware/en/latest/pages/DM1092.html>`__
* `OAK-D-IoT-75 <https://docs.luxonis.com/projects/hardware/en/latest/pages/DM1098OBC.html>`__
* `OAK-D-PoE <https://docs.luxonis.com/projects/hardware/en/latest/pages/SJ2088POE.html>`__
* `OAK-D CM4 PoE <https://docs.luxonis.com/projects/hardware/en/latest/pages/SJ2088POE.html>`__
* `OAK-FFC-3P <https://docs.luxonis.com/projects/hardware/en/latest/pages/DM1090.html>`__
Expand Down
7 changes: 3 additions & 4 deletions docs/source/components/nodes/spi_in.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SPIIn
=====

SPIIn node is used for **receiving data** that was sent **from a MCU** (via SPI). `OAK-IOT <https://docs.luxonis.com/projects/hardware/en/latest/#iot-designs>`__ devices
have an on-board ESP32 that is connected to the VPU (MyriadX) via SPI. You can find demos `here <https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi>`__.
SPIIn node is used for **receiving data** that was sent **from a MCU** (via SPI).
You can find demos `here <https://github.com/luxonis/esp32-spi-message-demo>`__.

This allows you for example to control eg. :ref:`ColorCamera` or :ref:`ImageManip` from the MCU or send a :ref:`Buffer` of data from the MCU to a :ref:`Script` node.

Expand Down Expand Up @@ -65,8 +65,7 @@ Usage
Examples of functionality
#########################

- `SPI demos (host side) <https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi>`__
- `ESP32 code demos <https://github.com/luxonis/esp32-spi-message-demo>`__
- `SPI code demos with ESP32 <https://github.com/luxonis/esp32-spi-message-demo>`__

Reference
#########
Expand Down
7 changes: 3 additions & 4 deletions docs/source/components/nodes/spi_out.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SPIOut
======

SPIOut node is used for **sending data to a MCU** (via SPI). `OAK-IOT <https://docs.luxonis.com/projects/hardware/en/latest/#iot-designs>`__ devices
have an on-board ESP32 that is connected to the VPU (MyriadX) via SPI. You can find demos `here <https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi>`__.
SPIOut node is used for **sending data to a MCU** (via SPI).
You can find demos `here <https://github.com/luxonis/esp32-spi-message-demo>`__.

:ref:`SPIIn` is used for receiving data from the MCU (via SPI).

Expand Down Expand Up @@ -63,8 +63,7 @@ Usage
Examples of functionality
#########################

- `SPI demos (host side) <https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi>`__
- `ESP32 code demos <https://github.com/luxonis/esp32-spi-message-demo>`__
- `SPI code demos with ESP32 <https://github.com/luxonis/esp32-spi-message-demo>`__

Reference
#########
Expand Down
3 changes: 3 additions & 0 deletions docs/source/samples/bootloader/bootloader_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ the :code:`.json` bootloader config file via cmd arguments, which will get flash

Click on :ref:`Bootloader` for more information.

.. note::
We suggest using :ref:`Device Manager`, a GUI tool for interfacing with the bootloader and its configurations.

Demo
####

Expand Down
3 changes: 3 additions & 0 deletions docs/source/samples/bootloader/bootloader_version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This example shows basic bootloader interaction, retrieving the version of bootl

Click on :ref:`Bootloader` for more information.

.. note::
We suggest using :ref:`Device Manager`, a GUI tool for interfacing with the bootloader and its configurations.

Demo
####

Expand Down
3 changes: 3 additions & 0 deletions docs/source/samples/bootloader/flash_bootloader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ have flash on-board.

Click on :ref:`Bootloader` for more information.

.. note::
We suggest using :ref:`Device Manager`, a GUI tool for interfacing with the bootloader and its configurations.

Demo
####

Expand Down
3 changes: 3 additions & 0 deletions docs/source/samples/bootloader/poe_set_ip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This script allows you to set static or dynamic IP, or clear bootloader config o
device (you won't be able to access it), and will have to `factory reset <https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/getting-started-with-poe.html#factory-reset>`__
your OAK PoE.

.. note::
We suggest using :ref:`Device Manager`, a GUI tool for interfacing with the bootloader and its configurations.

Demo
####

Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/standalone_mode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Standalone mode
be achieved by first :ref:`flashing the bootloader <Flash bootloader>` and then :ref:`flashing the pipeline <Flash the pipeline>`
and assets (NN models) to the OAK's flash memory.

Standalone mode is **only possible on OAKs that have on-board flash** memory, which are currently `OAK IOT <https://docs.luxonis.com/projects/hardware/en/latest/#iot-designs>`__
and `OAK POE <https://docs.luxonis.com/projects/hardware/en/latest/#poe-designs>`__ camera models.
Standalone mode is **only possible on OAKs that have on-board flash** memory, which are currently
`OAK POE <https://docs.luxonis.com/projects/hardware/en/latest/#poe-designs>`__ and OAK IOT camera models.

Converting a demo to standalone mode
####################################
Expand Down
15 changes: 10 additions & 5 deletions generate_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import tempfile
import os
import textwrap

# Usage
if len(sys.argv) < 3:
Expand Down Expand Up @@ -39,7 +40,15 @@
contents = file.read()

# Add imports
stubs_import = 'import depthai.node as node\nimport typing\nimport json\n' + contents
stubs_import = textwrap.dedent('''
# Ensures that the stubs are picked up - thanks, numpy project
from depthai import (
node as node,
)
import typing
import json
''') + contents

# Create 'create' overloads
nodes = re.findall('def \S*\(self\) -> node.(\S*):', stubs_import)
Expand All @@ -48,10 +57,6 @@
overloads = overloads + f'\\1@overload\\1def create(self, arg0: typing.Type[node.{node}]) -> node.{node}: ...'
final_stubs = re.sub(r"([\s]*)def create\(self, arg0: object\) -> Node: ...", f'{overloads}', stubs_import)

# Modify "*View" naming
nodes = re.findall('View\\[(\S*)\\]', final_stubs)
final_stubs = re.sub(r"View\[(\S*)\]", f'View_\\1', final_stubs)

# Writeout changes
file.seek(0)
file.write(final_stubs)
Expand Down
Loading

0 comments on commit 5ee238c

Please sign in to comment.