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

IR Intensity API #924

Merged
merged 11 commits into from
Nov 23, 2023
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 "3181f130742ed4f18341970a936afbdcfeaddbc9")
set(DEPTHAI_DEVICE_SIDE_COMMIT "9f8bc9fe677b7a1fce27f78448fe348ce6e122e0")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
4 changes: 2 additions & 2 deletions examples/SpatialDetection/spatial_calculator_multi_roi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main() {

// Connect to device and start pipeline
dai::Device device(pipeline);
device.setIrLaserDotProjectorBrightness(1000);
device.setIrLaserDotProjectorIntensity(0.7f);

// Output queue will be used to get the depth frames from the outputs defined above
auto depthQueue = device.getOutputQueue("depth", 4, false);
Expand Down Expand Up @@ -106,4 +106,4 @@ int main() {
}
}
return 0;
}
}
28 changes: 26 additions & 2 deletions include/depthai/device/DeviceBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class DeviceBase {
* @param mask Optional mask to modify only Left (0x1) or Right (0x2) sides on OAK-D-Pro-W-DEV
* @returns True on success, false if not found or other failure
*/
bool setIrLaserDotProjectorBrightness(float mA, int mask = -1);
[[deprecated("Use setIrLaserDotProjectorIntensity(float intensity) instead.")]] bool setIrLaserDotProjectorBrightness(float mA, int mask = -1);

/**
* Sets the brightness of the IR Flood Light. Limits: up to 1500mA at 30% duty cycle.
Expand All @@ -506,7 +506,31 @@ class DeviceBase {
* @param mask Optional mask to modify only Left (0x1) or Right (0x2) sides on OAK-D-Pro-W-DEV
* @returns True on success, false if not found or other failure
*/
bool setIrFloodLightBrightness(float mA, int mask = -1);
[[deprecated("Use setIrFloodLightIntensity(float intensity) instead.")]] bool setIrFloodLightBrightness(float mA, int mask = -1);

/**
* Sets the intensity of the IR Laser Dot Projector. Limits: up to 765mA at 30% frame time duty cycle when exposure time is longer than 30% frame time.
* Otherwise, duty cycle is 100% of exposure time, with current increased up to max 1200mA to make up for shorter duty cycle.
* The duty cycle is controlled by `left` camera STROBE, aligned to start of exposure.
* The emitter is turned off by default
*
* @param intensity Intensity on range 0 to 1, that will determine brightness. 0 or negative to turn off
* @param mask Optional mask to modify only Left (0x1) or Right (0x2) sides on OAK-D-Pro-W-DEV
* @returns True on success, false if not found or other failure
*/
bool setIrLaserDotProjectorIntensity(float intensity, int mask = -1);

/**
* Sets the intensity of the IR Flood Light. Limits: Intensity is directly normalized to 0 - 1500mA current.
* The duty cycle is 30% when exposure time is longer than 30% frame time. Otherwise, duty cycle is 100% of exposure time.
* The duty cycle is controlled by the `left` camera STROBE, aligned to start of exposure.
* The emitter is turned off by default
*
* @param intensity Intensity on range 0 to 1, that will determine brightness, 0 or negative to turn off
* @param mask Optional mask to modify only Left (0x1) or Right (0x2) sides on OAK-D-Pro-W-DEV
* @returns True on success, false if not found or other failure
*/
bool setIrFloodLightIntensity(float intensity, int mask = -1);

/**
* Retrieves detected IR laser/LED drivers.
Expand Down
2 changes: 1 addition & 1 deletion shared/depthai-shared
12 changes: 10 additions & 2 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,11 +1089,19 @@ LogLevel DeviceBase::getLogOutputLevel() {
}

bool DeviceBase::setIrLaserDotProjectorBrightness(float mA, int mask) {
return pimpl->rpcClient->call("setIrLaserDotProjectorBrightness", mA, mask);
return pimpl->rpcClient->call("setIrLaserDotProjectorBrightness", mA, mask, false);
}

bool DeviceBase::setIrLaserDotProjectorIntensity(float intensity, int mask) {
return pimpl->rpcClient->call("setIrLaserDotProjectorBrightness", intensity, mask, true);
}

bool DeviceBase::setIrFloodLightBrightness(float mA, int mask) {
return pimpl->rpcClient->call("setIrFloodLightBrightness", mA, mask);
return pimpl->rpcClient->call("setIrFloodLightBrightness", mA, mask, false);
}

bool DeviceBase::setIrFloodLightIntensity(float intensity, int mask) {
return pimpl->rpcClient->call("setIrFloodLightBrightness", intensity, mask, true);
}

std::vector<std::tuple<std::string, int, int>> DeviceBase::getIrDrivers() {
Expand Down
Loading