Hi,
To implement a software life-cycle and control the OAK device inside a docker container: We have written a wrapper around OAK-D device. Inside this wrapper, we use depthai-sdk. I'm trying to record the OAK-D-S2-PoE output stream using the Record class from depthai-sdk as:
# Initialize the recording object with the specified save path and stream device
self.recording = Record(self.oak_save_path, self.streamDevice)
when I look at the class initilization of Record class I see:
def __init__(self, path: Path, device: dai.Device, args: dict = None):
Inside the init function: ArgsManager.parseArgs() is called since args is None
if args is None:
args = ArgsManager.parseArgs()
When I look at the inside ArgsManager.parseArgs()
function itself, I see:
def parseArgs(parser: argparse.ArgumentParser = None):
…
if parser is None:
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
…
This parser interfere with the original wrapper class parser. Which creates the below error on Record class initilization:
python3 app.py --env local -or or1 --stream_name oak1
the terminal output:
[2024-06-25 20:09:35.404] [depthai] [warning] [18443010A18E970F00] [192.168.0.107] Flashed bootloader version 0.0.22, less than 0.0.28 is susceptible to bootup/restart failure. Upgrading is advised, flashing main/factory (not user) bootloader. Available: 0.0.28
usage: app.py [-h] [-cam {left,right,color}] [-vid VIDEO] [-dd] [-dnn] [-cnnp CNNPATH] [-cnn CNNMODEL] [-sh SHAVES] [-cnnsize CNNINPUTSIZE]
[-rgbr RGBRESOLUTION] [-rgbf RGBFPS] [-monor MONORESOLUTION] [-monof MONOFPS] [-fps FPS] [-dct DISPARITYCONFIDENCETHRESHOLD]
[-lrct LRCTHRESHOLD] [-sig SIGMA] [-med {0,3,5,7}] [-dlrc] [-ext] [-sub]
[-cm {AUTUMN,BONE,CIVIDIS,COOL,DEEPGREEN,HOT,HSV,INFERNO,JET,MAGMA,OCEAN,PARULA,PINK,PLASMA,RAINBOW,SPRING,SUMMER,TURBO,TWILIGHT,TWILIGHT_SHIFTED,VIRIDIS,WINTER}]
[-maxd MAXDEPTH] [-mind MINDEPTH] [-sbb] [-sbbsf SBBSCALEFACTOR]
[-s {nnInput,color,left,right,depth,depthRaw,disparity,disparityColor,rectifiedLeft,rectifiedRight} [{nnInput,color,left,right,depth,depthRaw,disparity,disparityColor,rectifiedLeft,rectifiedRight} ...]]
[-dff] [--report {temp,cpu,memory} [{temp,cpu,memory} ...]] [--reportFile REPORTFILE] [-cb CALLBACK]
[--openvinoVersion {2020_3,2020_4,2021_1,2021_2,2021_3,2021_4,2022_1,UNIVERSAL}] [--count COUNTLABEL] [-dev DEVICEID]
[-bandw {auto,low,high}] [-gt {auto,qt,cv}] [-usbs {usb2,usb3}] [-enc ENCODE [ENCODE ...]] [-encout ENCODEOUTPUT] [-xls XLINKCHUNKSIZE]
[-poeq POEQUALITY] [-camo CAMERAORIENTATION [CAMERAORIENTATION ...]] [--cameraControls]
[--cameraExposure CAMERAEXPOSURE [CAMERAEXPOSURE ...]] [--cameraSensitivity CAMERASENSITIVITY [CAMERASENSITIVITY ...]]
[--cameraSaturation CAMERASATURATION [CAMERASATURATION ...]] [--cameraContrast CAMERACONTRAST [CAMERACONTRAST ...]]
[--cameraBrightness CAMERABRIGHTNESS [CAMERABRIGHTNESS ...]] [--cameraSharpness CAMERASHARPNESS [CAMERASHARPNESS ...]]
[--irDotBrightness IRDOTBRIGHTNESS] [--irFloodBrightness IRFLOODBRIGHTNESS] [--skipVersionCheck] [--noSupervisor] [--sync]
[--noRgbDepthAlign] [--debug] [-app {uvc,record}] [-tun CAMERATUNING]
app.py: error: unrecognized arguments: --env local -or or1 --stream_name oak1
For a better visulazation of the error I add the SS of the error here.

But there is already these arguments inside app.py .
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-e", "--environment", type=str)
parser.add_argument("-or", "--operating_room", type=str)
parser.add_argument("-sn", "--stream_name", type=str)
args = parser.parse_args()
I understand your intention is to start the recording with default parameters or take input arguments. But current ArgsManager.parseArgs()
implementation creates problem due to parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
line.
Is there a known solution for this problem? Or is changing the way Record class takes input arguments an option for sdk design?
Details are as follows:
Device: OAK-D S2 PoE
depthai versions are:
pip list| grep depthai
depthai 2.26.0.0
depthai-pipeline-graph 0.0.5
depthai-sdk 1.2.3