Skip to content

Commit bddef95

Browse files
authored
Merge branch 'main' into docs_fix_figure_disp_shift
2 parents 1eb40bd + 0da2d02 commit bddef95

File tree

8 files changed

+94
-3
lines changed

8 files changed

+94
-3
lines changed
Binary file not shown.
254 KB
Loading

docs/source/components/nodes/stereo_depth.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
StereoDepth
22
###########
33

4-
StereoDepth node calculates the disparity/depth from the stereo camera pair (2x :ref:`MonoCamera <MonoCamera>`/:ref:`ColorCamera`).
4+
StereoDepth node calculates the disparity and/or depth from the stereo camera pair (2x :ref:`MonoCamera <MonoCamera>`/:ref:`ColorCamera`).
5+
We suggest following :ref:`Configuring Stereo Depth` tutorial to achieve the best depth results.
56

67
How to place it
78
===============
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Script UART communication
2+
=========================
3+
4+
This example uses :ref:`Script` node for `UART communication <https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter>`__. Note that OAK
5+
cameras don't have UART pins easily disposed, and we soldered wires on `OAK-FFC-4P <https://docs.luxonis.com/projects/hardware/en/latest/pages/DD2090.html>`__
6+
to expose UART pins.
7+
8+
.. note::
9+
10+
This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration.
11+
12+
Demo
13+
####
14+
15+
.. raw:: html
16+
17+
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; height: auto;">
18+
<iframe src="https://www.youtube.com/embed/nbS1BczO5sE" frameborder="0" allowfullscreen style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"></iframe>
19+
</div>
20+
21+
22+
.. figure:: https://user-images.githubusercontent.com/18037362/232458809-a36dc418-6bb5-411f-9172-5130a926191d.jpg
23+
24+
Oscilloscope connected to the OAK-FFC-4P UART pins
25+
26+
Setup
27+
#####
28+
29+
.. include:: /includes/install_from_pypi.rst
30+
31+
Source code
32+
###########
33+
34+
.. tabs::
35+
36+
.. tab:: Python
37+
38+
Also `available on GitHub <https://github.com/luxonis/depthai-python/blob/main/examples/Script/script_uart.py>`__
39+
40+
.. literalinclude:: ../../../../examples/Script/script_uart.py
41+
:language: python
42+
:linenos:
43+
44+
.. tab:: C++
45+
46+
Not yet available
47+
48+
49+
.. include:: /includes/footer-short.rst

docs/source/tutorials/code_samples.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ are presented with code.
122122
- :ref:`Script HTTP server` - Serve still image over HTTP response (only OAK-POE devices)
123123
- :ref:`Script MJPEG server` - Serve MJPEG video stream over HTTP response (only OAK-POE devices)
124124
- :ref:`Script NNData example` - Constructs :ref:`NNData` in Script node and sends it to the host
125+
- :ref:`Script UART communication` - UART communication with Script node
125126

126127
.. rubric:: SpatialDetection
127128

docs/source/tutorials/configuring-stereo-depth.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ Stereo subpixel effect on layering
287287
Default stereo depth output has 0..95 disparity pixels, which would produce 96 unique depth values. This can especially be seen when using pointcloud representation
288288
and seeing how there are discrete "layers" of points, instead of a smooth transition:
289289

290-
.. image:: /_static/images/components/layered-pointcloud.png
290+
.. image:: /_static/images/components/pointcloud_layering.jpg
291291

292292
This layering can especially be seen at longer distances, where these layers are exponentially further apart.
293293

docs/source/tutorials/low-latency.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Bandwidth
133133

134134
With large, unencoded frames, one can quickly saturate the bandwidth even at 30FPS, especially on PoE devices (1gbps link):
135135

136-
.. code-block::bash
136+
.. code-block::
137137
138138
4K NV12/YUV420 frames: 3840 * 2160 * 1.5 * 30fps * 8bits = 3 gbps
139139
1080P NV12/YUV420 frames: 1920 * 1080 * 1.5 * 30fps * 8bits = 747 mbps

examples/Script/script_uart.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env python3
2+
'''
3+
NOTE: This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration!
4+
'''
5+
import depthai as dai
6+
import time
7+
8+
# Start defining a pipeline
9+
pipeline = dai.Pipeline()
10+
11+
script = pipeline.create(dai.node.Script)
12+
script.setScript("""
13+
import serial
14+
import time
15+
16+
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
17+
i = 0
18+
while True:
19+
i += 1
20+
time.sleep(0.1)
21+
serString = f'TEST_{i}'
22+
ser.write(serString.encode())
23+
""")
24+
# Define script for output
25+
script.setProcessor(dai.ProcessorType.LEON_CSS)
26+
27+
28+
config = dai.Device.Config()
29+
# Get argument first
30+
GPIO = dai.BoardConfig.GPIO
31+
config.board.gpio[15] = GPIO(GPIO.OUTPUT, GPIO.ALT_MODE_2)
32+
config.board.gpio[16] = GPIO(GPIO.INPUT, GPIO.ALT_MODE_2)
33+
config.board.uart[0] = dai.BoardConfig.UART()
34+
35+
36+
with dai.Device(config) as device:
37+
device.startPipeline(pipeline)
38+
print("Pipeline started")
39+
while True:
40+
time.sleep(1)

0 commit comments

Comments
 (0)