From 6b4974573ec2422dbf75eeb72c3ffe2fc8da1758 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Tue, 29 Sep 2020 00:43:54 +0300 Subject: [PATCH 1/4] Add ISP 3A camera controls --- cmake/Depthai/DepthaiDeviceSideConfig.cmake | 2 +- include/depthai/device.hpp | 3 +++ include/depthai/host_capture_command.hpp | 1 + shared/depthai-shared | 2 +- src/device.cpp | 7 +++++++ src/host_capture_command.cpp | 10 ++++++++++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index 9a03d9086..67e989890 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "2f9c918bc823a0fbeb4ce54696966045ca7cb13c") +set(DEPTHAI_DEVICE_SIDE_COMMIT "986dd413a954497ab76af4f9afdc5b2c8d404423") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") diff --git a/include/depthai/device.hpp b/include/depthai/device.hpp index 5945b3ee1..1c963784e 100644 --- a/include/depthai/device.hpp +++ b/include/depthai/device.hpp @@ -6,6 +6,7 @@ //shared #include "depthai-shared/xlink/xlink_wrapper.hpp" +#include "depthai-shared/metadata/camera_control.hpp" //project #include "nlohmann/json.hpp" @@ -47,6 +48,8 @@ class Device{ void request_af_trigger(); void request_af_mode(CaptureMetadata::AutofocusMode mode); void send_disparity_confidence_threshold(uint8_t confidence); + void send_camera_control(Isp3A_CamId camera_id, Isp3A_Commands command_id, + const std::string &extra_args); std::map get_nn_to_depth_bbox_mapping(); diff --git a/include/depthai/host_capture_command.hpp b/include/depthai/host_capture_command.hpp index 8f29cfd43..ffa63828b 100644 --- a/include/depthai/host_capture_command.hpp +++ b/include/depthai/host_capture_command.hpp @@ -15,6 +15,7 @@ class HostCaptureCommand void afTrigger(); void sendDisparityConfidenceThreshold(uint8_t confidence_thr); void sendCustomDeviceResetRequest(void); + void sendIsp3A(int camera_id, int command_id, const char *extra_args); private: StreamInfo stream; diff --git a/shared/depthai-shared b/shared/depthai-shared index 3d2ce04ef..461678227 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit 3d2ce04ef3a3b38d63917b1df240841d0e9b2477 +Subproject commit 461678227b6e987c6ec136ee6a6c21b6c7edd766 diff --git a/src/device.cpp b/src/device.cpp index a3bcf8633..9b4858666 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -1258,6 +1258,13 @@ void Device::send_disparity_confidence_threshold(uint8_t confidence){ } } +void Device::send_camera_control(Isp3A_CamId camera_id, Isp3A_Commands command_id, + const std::string &extra_args) { + if(g_host_capture_command != nullptr) { + g_host_capture_command->sendIsp3A(camera_id, command_id, extra_args.c_str()); + } +} + std::map Device::get_nn_to_depth_bbox_mapping(){ return nn_to_depth_mapping; } diff --git a/src/host_capture_command.cpp b/src/host_capture_command.cpp index 75afcf7d4..219ac3b84 100644 --- a/src/host_capture_command.cpp +++ b/src/host_capture_command.cpp @@ -27,6 +27,16 @@ void HostCaptureCommand::sendCustomDeviceResetRequest(void){ notifyObservers(stream, custom_reset); } +void HostCaptureCommand::sendIsp3A(int camera_id, int command_id, const char *extra_args) { + StreamData cmd_data; + char cmdfull[256]; + snprintf(cmdfull, sizeof cmdfull, "3A %d %d %s", command_id, camera_id, extra_args); + cmd_data.packet_number = 0; + cmd_data.data = cmdfull; + cmd_data.size = strlen(cmdfull) + 1; + notifyObservers(stream, cmd_data); +} + void HostCaptureCommand::capture(){ sendCaptureMetadata(CaptureMetadata::createStillCapture()); } From 84083a0ad60df08194b963ed13c8140fc8b612e1 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Tue, 6 Oct 2020 00:36:06 +0300 Subject: [PATCH 2/4] Slightly refactor CameraControl API. Address review comments. --- include/depthai/device.hpp | 7 ++++--- include/depthai/host_capture_command.hpp | 5 ++++- shared/depthai-shared | 2 +- src/device.cpp | 7 ++++--- src/host_capture_command.cpp | 11 ++++++----- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/include/depthai/device.hpp b/include/depthai/device.hpp index 1c963784e..61efdf939 100644 --- a/include/depthai/device.hpp +++ b/include/depthai/device.hpp @@ -48,8 +48,9 @@ class Device{ void request_af_trigger(); void request_af_mode(CaptureMetadata::AutofocusMode mode); void send_disparity_confidence_threshold(uint8_t confidence); - void send_camera_control(Isp3A_CamId camera_id, Isp3A_Commands command_id, - const std::string &extra_args); + void send_camera_control(CameraControl::CamId camera_id, + CameraControl::Command command_id, + const std::string &extra_args); std::map get_nn_to_depth_bbox_mapping(); @@ -126,4 +127,4 @@ class Device{ XLinkHandler_t g_xlink_device_handler = {}; -}; \ No newline at end of file +}; diff --git a/include/depthai/host_capture_command.hpp b/include/depthai/host_capture_command.hpp index ffa63828b..6cfaf8e59 100644 --- a/include/depthai/host_capture_command.hpp +++ b/include/depthai/host_capture_command.hpp @@ -4,6 +4,7 @@ #include "depthai-shared/general/data_subject.hpp" #include "depthai-shared/stream/stream_data.hpp" #include "depthai-shared/metadata/capture_metadata.hpp" +#include "depthai-shared/metadata/camera_control.hpp" class HostCaptureCommand : public DataSubject @@ -15,7 +16,9 @@ class HostCaptureCommand void afTrigger(); void sendDisparityConfidenceThreshold(uint8_t confidence_thr); void sendCustomDeviceResetRequest(void); - void sendIsp3A(int camera_id, int command_id, const char *extra_args); + void sendCameraControl(CameraControl::CamId camera_id, + CameraControl::Command command_id, + std::string extra_args = ""); private: StreamInfo stream; diff --git a/shared/depthai-shared b/shared/depthai-shared index 461678227..6a9be549d 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit 461678227b6e987c6ec136ee6a6c21b6c7edd766 +Subproject commit 6a9be549d41beda5250f779cc0dbee0e5deae90f diff --git a/src/device.cpp b/src/device.cpp index 9b4858666..cc1c138f9 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -1258,10 +1258,11 @@ void Device::send_disparity_confidence_threshold(uint8_t confidence){ } } -void Device::send_camera_control(Isp3A_CamId camera_id, Isp3A_Commands command_id, - const std::string &extra_args) { +void Device::send_camera_control(CameraControl::CamId camera_id, + CameraControl::Command command_id, + const std::string &extra_args) { if(g_host_capture_command != nullptr) { - g_host_capture_command->sendIsp3A(camera_id, command_id, extra_args.c_str()); + g_host_capture_command->sendCameraControl(camera_id, command_id, extra_args.c_str()); } } diff --git a/src/host_capture_command.cpp b/src/host_capture_command.cpp index 219ac3b84..ec4859b87 100644 --- a/src/host_capture_command.cpp +++ b/src/host_capture_command.cpp @@ -27,13 +27,14 @@ void HostCaptureCommand::sendCustomDeviceResetRequest(void){ notifyObservers(stream, custom_reset); } -void HostCaptureCommand::sendIsp3A(int camera_id, int command_id, const char *extra_args) { +void HostCaptureCommand::sendCameraControl(CameraControl::CamId camera_id, + CameraControl::Command command_id, + std::string extra_args) { + std::string cmdfull = CameraControl::createCommandStr(camera_id, command_id, extra_args); StreamData cmd_data; - char cmdfull[256]; - snprintf(cmdfull, sizeof cmdfull, "3A %d %d %s", command_id, camera_id, extra_args); cmd_data.packet_number = 0; - cmd_data.data = cmdfull; - cmd_data.size = strlen(cmdfull) + 1; + cmd_data.data = (void*)cmdfull.c_str(); + cmd_data.size = cmdfull.size() + 1 /*NULL terminator*/; notifyObservers(stream, cmd_data); } From 23bb47e99f5301a49d11cc26847ea3aeee9a8976 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Tue, 6 Oct 2020 00:58:37 +0300 Subject: [PATCH 3/4] Update device side SHA (depthai-shared changed) --- cmake/Depthai/DepthaiDeviceSideConfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index 67e989890..47d853a5b 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "986dd413a954497ab76af4f9afdc5b2c8d404423") +set(DEPTHAI_DEVICE_SIDE_COMMIT "2dc84f49e816a826a0a396a430c5588066643587") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") From 173d43ccbb11398b84a04c6e85fddfaf901ec454 Mon Sep 17 00:00:00 2001 From: alex-luxonis Date: Wed, 7 Oct 2020 16:32:04 +0300 Subject: [PATCH 4/4] Update depthai-shared (and device side with it) --- cmake/Depthai/DepthaiDeviceSideConfig.cmake | 2 +- shared/depthai-shared | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index 47d853a5b..a60978344 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "2dc84f49e816a826a0a396a430c5588066643587") +set(DEPTHAI_DEVICE_SIDE_COMMIT "a6547dca63c1705d09d7225020f101e53e94183a") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") diff --git a/shared/depthai-shared b/shared/depthai-shared index 6a9be549d..82435d4ea 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit 6a9be549d41beda5250f779cc0dbee0e5deae90f +Subproject commit 82435d4ead9e3b103254a0e397e9d6e60c4cd2c7