Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime stereo calib reconfig #1022

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "afbcd8ce64e3fadb9c981890b31575e635a64322")
set(DEPTHAI_DEVICE_SIDE_COMMIT "8f7256cfebe29b56e649b0ee6aedba3fa20c5142")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
3 changes: 1 addition & 2 deletions include/depthai/common/CameraFeatures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ inline std::ostream& operator<<(std::ostream& out, const dai::CameraSensorConfig
out << "minFps: " << config.minFps << ", ";
out << "maxFps: " << config.maxFps << ", ";
out << "type: " << config.type << ", ";
out << "fov: "
<< "{x:" << config.fov.x << ", ";
out << "fov: " << "{x:" << config.fov.x << ", ";
out << "y: " << config.fov.y << ", ";
out << "width: " << config.fov.width << ", ";
out << "height: " << config.fov.height << "}";
Expand Down
17 changes: 17 additions & 0 deletions include/depthai/device/DeviceBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,23 @@ class DeviceBase {
*/
void flashCalibration2(CalibrationHandler calibrationDataHandler);

/**
* Sets the Calibration at runtime. This is not persistent and will be lost after device reset.
*
* @throws std::runtime_exception if failed to set the calibration
* @param calibrationObj CalibrationHandler object which is loaded with calibration information.
*
*/
void setCalibration(CalibrationHandler calibrationDataHandler);

/**
* Retrieves the CalibrationHandler object containing the non-persistent calibration
*
* @throws std::runtime_exception if failed to get the calibration
* @returns The CalibrationHandler object containing the non-persistent calibration
*/
CalibrationHandler getCalibration();

/**
* Fetches the EEPROM data from the device and loads it into CalibrationHandler object
* If no calibration is flashed, it returns default
Expand Down
20 changes: 20 additions & 0 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,26 @@ void DeviceBase::flashCalibration2(CalibrationHandler calibrationDataHandler) {
}
}

void DeviceBase::setCalibration(CalibrationHandler calibrationDataHandler) {
bool success;
std::string errorMsg;
std::tie(success, errorMsg) = pimpl->rpcClient->call("setCalibration", calibrationDataHandler.getEepromData()).as<std::tuple<bool, std::string>>();
if(!success) {
throw std::runtime_error(errorMsg);
}
}

CalibrationHandler DeviceBase::getCalibration() {
bool success;
std::string errorMsg;
dai::EepromData eepromData;
std::tie(success, errorMsg, eepromData) = pimpl->rpcClient->call("getCalibration").as<std::tuple<bool, std::string, dai::EepromData>>();
if(!success) {
throw EepromError(errorMsg);
}
return CalibrationHandler(eepromData);
}

CalibrationHandler DeviceBase::readCalibration() {
dai::EepromData eepromData{};
try {
Expand Down
4 changes: 1 addition & 3 deletions tests/src/stability_stress_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,7 @@ int main(int argc, char** argv) {
unique_lock<mutex> l(countersMtx);

bool failed = counters.size() == 0;
cout << "[" << duration_cast<seconds>(steady_clock::now() - timeoutStopwatch).count() << "s] "
<< "Usb speed " << usb_speed << " "
<< "FPS: ";
cout << "[" << duration_cast<seconds>(steady_clock::now() - timeoutStopwatch).count() << "s] " << "Usb speed " << usb_speed << " " << "FPS: ";
for(const auto& kv : counters) {
if(kv.second == 0) {
failed = true;
Expand Down
Loading