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

RVC4 manual focus #1206

Open
wants to merge 3 commits into
base: v3_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/DepthaiDeviceRVC4Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set(DEPTHAI_DEVICE_RVC4_MATURITY "snapshot")

# "version if applicable"
# set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+93f7b75a885aa32f44c5e9f53b74470c49d2b1af")
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+670797e3b8cbc185c7d457e24382495200486573")
set(DEPTHAI_DEVICE_RVC4_VERSION "0.0.1+5c6b7bd7d23f9bd8cfba3a0feb2e10ab6101e48a")
4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ dai_set_test_labels(image_manip_v2_node_test ondevice rvc2_all rvc4 ci)
dai_add_test(benchmark_test src/ondevice_tests/pipeline/node/benchmark_test.cpp)
dai_set_test_labels(benchmark_test ondevice rvc2_all rvc4 ci)

# Manual focus test
dai_add_test(manual_focus_test src/ondevice_tests/manual_focus_test.cpp)
dai_set_test_labels(manual_focus_test rvc2_all rvc4 ci)

# IMU tests
dai_add_test(imu_test src/ondevice_tests/pipeline/node/imu_test.cpp)
dai_set_test_labels(imu_test ondevice rvc4 ci) # Many RVC2 devices do not have an IMU which supports the whole test suite
29 changes: 29 additions & 0 deletions tests/src/ondevice_tests/manual_focus_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <catch2/catch_all.hpp>

#include "depthai/depthai.hpp"

TEST_CASE("Test manual focus") {
dai::Pipeline pipeline;
auto fps = 30.0f;
auto camRgb = pipeline.create<dai::node::Camera>()->build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this always default to the color cam? Or should we discover the color cam first and then set the socket?

auto* output = camRgb->requestOutput(std::make_pair(640, 480), std::nullopt, dai::ImgResizeMode::CROP, fps);
auto outputQueue = output->createOutputQueue();
auto controlQueue = camRgb->inputControl.createInputQueue();
pipeline.start();
for(auto requestedLensPos : {0.5f, 0.8f, 1.0f, 0.733f, 0.444f, 0.2101f, 0.0f}) {
auto ctrl = std::make_shared<dai::CameraControl>();
ctrl->setManualFocusRaw(requestedLensPos);
std::cout << "Setting lens position to " << requestedLensPos << "\n" << std::flush;
controlQueue->send(ctrl);
auto lastLensPosition = -1.0f;
for(int idx = 0; idx < static_cast<int>(fps); ++idx) {
auto imgFrame = outputQueue->get<dai::ImgFrame>();
lastLensPosition = imgFrame->getLensPositionRaw();
}
std::cout << "Lens position after 1s was: " << lastLensPosition << "\n" << std::flush;
auto lensPositionDiff = std::abs(lastLensPosition - requestedLensPos);
std::cout << "Diff was: " << lensPositionDiff << "\n" << std::flush;
REQUIRE(lensPositionDiff < 0.001);
}
pipeline.stop();
}
Loading