Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e/move_global_properties
…e/move_global_properties
There was a problem hiding this comment.
Pull request overview
This PR splits device-scoped fields out of GlobalProperties into a new DeviceProperties model so device properties can be configured (and kept in sync) before the pipeline starts, and adds coverage to validate the new behavior.
Changes:
- Introduces
DeviceProperties(separate fromGlobalProperties) and updates serialization accordingly. - Updates
Pipeline/PipelineImplandDeviceBaseto set/query device properties (including camera tuning blobs, XLink chunk size, SIPP sizes, calibration/Eeprom data). - Adds a new on-device test suite for property-setting behavior and wires it into the test CMake.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
include/depthai/properties/GlobalProperties.hpp |
Splits pipeline-only fields into GlobalProperties and moves device fields into new DeviceProperties. |
include/depthai/pipeline/Pipeline.hpp |
Adds default-device-properties APIs and host-only storage for device properties. |
src/pipeline/Pipeline.cpp |
Implements device-property propagation to the default device and/or host-side tracked properties. |
include/depthai/device/DeviceBase.hpp |
Adds device property APIs (getProperties, setProperties, tuning blob setters, SIPP setters, calibration availability). |
src/device/DeviceBase.cpp |
Implements new DeviceBase RPC calls and initializes cached properties. |
bindings/python/src/pipeline/PipelineBindings.cpp |
Updates Python bindings: trims GlobalProperties fields and adds DeviceProperties binding. |
tests/src/ondevice_tests/device_properties_test.cpp |
New tests verifying pre-start application, post-start behavior, and host/device sync. |
tests/CMakeLists.txt |
Registers the new device properties test. |
src/properties/Properties.cpp |
Adds DeviceProperties destructor definition. |
cmake/Depthai/DepthaiDeviceRVC4Config.cmake |
Updates embedded RVC4 version string. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| std::filesystem::path writeTempFile(const std::string& prefix, const std::vector<std::uint8_t>& data) { | ||
| auto now = std::chrono::steady_clock::now().time_since_epoch().count(); | ||
| std::filesystem::path path = std::filesystem::temp_directory_path() / (prefix + "_" + std::to_string(now) + ".bin"); | ||
| std::ofstream out(path, std::ios::binary); | ||
| out.write(reinterpret_cast<const char*>(data.data()), static_cast<std::streamsize>(data.size())); | ||
| out.close(); | ||
| return path; | ||
| } |
There was a problem hiding this comment.
writeTempFile() creates files in the system temp directory but the tests never remove them. On CI or repeated local runs this can leave behind a growing number of files. Consider using a small RAII helper (or std::filesystem::remove in a SCOPE_EXIT/finally-style guard) to ensure cleanup even on test failures.
| bool PipelineImpl::isCalibrationDataAvailable() const { | ||
| return globalProperties.calibData.has_value(); | ||
| if(defaultDevice) { | ||
| return defaultDevice->isCalibrationAvailable(); | ||
| } | ||
| if(defaultDeviceProperties != nullptr) { | ||
| return defaultDeviceProperties->calibData.has_value(); | ||
| } |
There was a problem hiding this comment.
isCalibrationDataAvailable() ignores defaultDeviceProperties->calibData whenever defaultDevice exists, so it can return a value inconsistent with getCalibrationData() and with the Pipeline.hpp docs (which describe whether pipeline calibration override has been set). Also, reads of defaultDeviceProperties->calibData here are not protected by calibMtx even though writes in setEepromData() are locked, which can lead to a data race. Consider checking defaultDeviceProperties->calibData first (under calibMtx) and only falling back to the device query if needed (or renaming/retargeting the API if the intent changed).
| CalibrationHandler PipelineImpl::getCalibrationData() const { | ||
| if(globalProperties.calibData) { | ||
| return CalibrationHandler(globalProperties.calibData.value()); | ||
| } else { | ||
| return CalibrationHandler(); | ||
| if(defaultDeviceProperties == nullptr) { | ||
| throw std::runtime_error("No default device properties set in pipeline"); | ||
| } | ||
| if(defaultDeviceProperties->calibData.has_value()) { | ||
| return CalibrationHandler(defaultDeviceProperties->calibData.value()); | ||
| } |
There was a problem hiding this comment.
getCalibrationData() reads defaultDeviceProperties->calibData without taking calibMtx, but setEepromData() updates that field under the mutex. To avoid a potential data race, take calibMtx while checking/reading calibData (or copy the optional under lock before branching).
| * @param sizeBytes SIPP buffer size in bytes. Device default is 2 * 1024 * 1024 bytes | ||
| */ | ||
| void setSippBufferSize(int sizeBytes); | ||
|
|
||
| /** | ||
| * Sets the size of the SIPP DMA buffer on the device. | ||
| * | ||
| * @param sizeBytes SIPP DMA buffer size in bytes. Device default is 2 * 1024 * 1024 bytes |
There was a problem hiding this comment.
The docstrings for setSippBufferSize / setSippDmaBufferSize state a device default of 2 * 1024 * 1024 bytes, but DeviceProperties in GlobalProperties.hpp defines defaults as 18 * 1024 and 16 * 1024 respectively. Please update the documentation to reflect the actual defaults (or adjust the constants if the docs are correct).
| * @param sizeBytes SIPP buffer size in bytes. Device default is 2 * 1024 * 1024 bytes | |
| */ | |
| void setSippBufferSize(int sizeBytes); | |
| /** | |
| * Sets the size of the SIPP DMA buffer on the device. | |
| * | |
| * @param sizeBytes SIPP DMA buffer size in bytes. Device default is 2 * 1024 * 1024 bytes | |
| * @param sizeBytes SIPP buffer size in bytes. Device default is 18 * 1024 bytes | |
| */ | |
| void setSippBufferSize(int sizeBytes); | |
| /** | |
| * Sets the size of the SIPP DMA buffer on the device. | |
| * | |
| * @param sizeBytes SIPP DMA buffer size in bytes. Device default is 16 * 1024 bytes |
…epthai-core into feature/move_global_properties
…e/move_global_properties
Purpose
Split global properties into DeviceProperties to allow setting properties before pipeline starts
Specification
None / not applicable
Dependencies & Potential Impact
None / not applicable
Deployment Plan
None / not applicable
Testing & Validation
None / not applicable