Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
python-architecture: [x64, x86]
steps:
- name: Cache .hunter folder
uses: actions/cache@v2
Expand All @@ -32,9 +33,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.python-architecture }}
- name: Append build hash if not a tagged commit
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -51,7 +53,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- name: Cache .hunter folder
uses: actions/cache@v2
Expand All @@ -67,14 +69,14 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Append build hash if not a tagged commit
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
brew install libusb
python -m pip install delocate
- name: Set macos deployment target
run: echo '::set-env name=MACOSX_DEPLOYMENT_TARGET::10.9'
run: echo "MACOSX_DEPLOYMENT_TARGET=10.9" >> $GITHUB_ENV
- name: Building wheels
run: python -m pip wheel . -w ./wheelhouse/
- name: Auditing wheels
Expand Down Expand Up @@ -111,10 +113,10 @@ jobs:
run: mkdir -p wheelhouse/audited/
- name: Append build hash if not a tagged commit
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
- name: Building a source distribution
run: |
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar,zip
/opt/python/cp38-cp38/bin/python3.8 setup.py sdist --formats=gztar
mv dist/* wheelhouse/audited/
- name: Building wheels
run: for PYBIN in /opt/python/cp3*/bin; do "${PYBIN}/pip" wheel . -w ./wheelhouse/; done
Expand All @@ -141,7 +143,7 @@ jobs:
submodules: 'recursive'
- name: Append build hash if not a tagged commit
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo '::set-env name=BUILD_COMMIT_HASH::${{github.sha}}'
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
- name: Building wheel
run: python3 -m pip wheel . -w ./wheelhouse/
- name: Auditing wheel
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ target_link_libraries(${TARGET_NAME}

# Add bindings revision
target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_BINDINGS_REVISION="${PROJECT_VERSION}")
# Add commit hash, default to "dev"
if(NOT DEPTHAI_PYTHON_COMMIT_HASH)

# Add default commit hash (dev) if not build by CI
if(NOT DEFINED ENV{CI} AND NOT DEPTHAI_PYTHON_COMMIT_HASH)
set(DEPTHAI_PYTHON_COMMIT_HASH dev)
endif()

# Add compile definition for bindings
if(DEPTHAI_PYTHON_COMMIT_HASH)
target_compile_definitions(${TARGET_NAME} PRIVATE DEPTHAI_PYTHON_COMMIT_HASH="${DEPTHAI_PYTHON_COMMIT_HASH}")
endif()
Expand Down
69 changes: 68 additions & 1 deletion src/device_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,76 @@ void init_binding_device(pybind11::module& m){
"Returns a vector defining how much the right camera is translated w.r.t left camera."
)

.def(
"is_usb3",
&Device::is_usb3,
"Return true if connected over usb3 or else false."
)

.def(
"get_mx_id",
&Device::get_mx_id,
"Return the Myraid X serial number of the device."
)

.def(
"is_eeprom_loaded",
&Device::is_eeprom_loaded,
"Return true if EEPROM has both intrinsic matrixes."
)

.def(
"is_device_changed",
&Device::is_device_changed,
"Return true if device is swapped while running over watchdog thread."
)

.def(
"reset_device_changed",
&Device::reset_device_changed,
"Sets device_changed var to false to detect the next swap while running over watchdog thread."
)

.def(
"is_rgb_connected",
&Device::is_rgb_connected,
"Returns true if RGB camera is connected."
)

.def(
"is_left_connected",
&Device::is_left_connected,
"Returns true if left stereo camera is connected."
)

;
.def(
"is_right_connected",
&Device::is_right_connected,
"Returns true if right stereo camera is connected."
)
.def(
"write_eeprom_data",
[](Device& device, py::dict config)
{
// str(dict) for string representation uses ['] , but JSON requires ["]
// fast & dirty solution:
std::string str = py::str(config);
boost::replace_all(str, "\'", "\"");
boost::replace_all(str, "None", "null");
boost::replace_all(str, "True", "true");
boost::replace_all(str, "False", "false");
// TODO: make better json serialization

return device.write_eeprom_data(str);
},
"Takes board config and calibration data as input and writes to eeprom",
py::arg("config") = py::dict()
)
.def(
"get_pipeline",
&Device::get_pipeline,
"Returns shared ptr of CNNHostPipeline created using cerate_pipeline."
);


py::enum_<CaptureMetadata::AutofocusMode>(m, "AutofocusMode")
Expand Down