Hi!
I'm trying to hardware sync 2 x OAK-FFC OV9282, 1 x OAK-FFC IMX378 in a OAK-FFC 4P board. I use latest DepthAi version v2.21.2, bootloader on device is on 0.24, latest. Cables between devices are ok, and all devices works ok under depthai_demo.
I take as reference, hardware sync from documentation and a post on this forum. This is my code in c++ :
#include "depthai/depthai.hpp"
#include <ostream>
int main(int argc, char* argv[]) {
dai::Pipeline pipeline;
auto odispa = pipeline.create<dai::node::XLinkOut>();
auto ocolor = pipeline.create<dai::node::XLinkOut>();
ocolor->setStreamName("rgb");
odispa->setStreamName("disparity");
auto color = pipeline.create<dai::node::ColorCamera>();
color->setInterleaved(true);
color->setResolution(dai::ColorCameraProperties::SensorResolution::THE_1080_P);
color->setFps(30);
color->setBoardSocket(dai::CameraBoardSocket::RGB);
color->setColorOrder( dai::ColorCameraProperties::ColorOrder::RGB);
color->initialControl.setFrameSyncMode( dai::CameraControl::FrameSyncMode::OUTPUT );
auto left = pipeline.create<dai::node::MonoCamera>();
left->setResolution(dai::MonoCameraProperties::SensorResolution::THE_720_P);
left->setBoardSocket(dai::CameraBoardSocket::LEFT);
left->setFps(30);
left->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
auto right = pipeline.create<dai::node::MonoCamera>();
right->setResolution(dai::MonoCameraProperties::SensorResolution::THE_720_P);
right->setBoardSocket(dai::CameraBoardSocket::RIGHT);
right->setFps(30);
right->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
auto stereo = pipeline.create<dai::node::StereoDepth>();
stereo->initialConfig.setConfidenceThreshold(254);
stereo->initialConfig.setMedianFilter(static_cast<dai::MedianFilter>(0));
if(false){ stereo->initialConfig.setBilateralFilterSigma(65000); }
stereo->setRectifyEdgeFillColor(0);
stereo->setLeftRightCheck(true);
stereo->setExtendedDisparity(false);
stereo->setSubpixel(true);
stereo->setDepthAlign(static_cast<dai::CameraBoardSocket>(0));
left->out.link(stereo->left);
right->out.link(stereo->right);
stereo->disparity.link(odispa->input);
color->isp.link(ocolor->input);
pipeline.getDeviceConfig().board.gpio[6] = dai::BoardConfig::GPIO(dai::BoardConfig::GPIO::Direction::OUTPUT, dai::BoardConfig::GPIO::Level::HIGH);
dai::Device device(pipeline);
device.setLogLevel(dai::LogLevel::DEBUG);
device.setLogOutputLevel(dai::LogLevel::DEBUG);
auto dispq = device.getOutputQueue("disparity",1, false);
auto rgbq = device.getOutputQueue("rgb",1, false);
while (true) {
try{
auto dispf = dispq->get<dai::ImgFrame>();
auto rgbf = rgbq->get<dai::ImgFrame>();
if(dispf && rgbf){
int64_t cft = rgbf->getTimestampDevice().time_since_epoch().count();
int64_t dft = dispf->getTimestampDevice().time_since_epoch().count();
std::cout << "DIFF: " << (cft - dft) / 1000 << std::endl;
}
}catch(...){
std::cout << "ERROR CAPTURING DATA" << std::endl;
if(!device.isClosed()){device.close();};
break;
}
}
};
Documentation its a little bit outdated, Fsyn its not specified for all sensors… for example if im trying to apply this fsyn values. If i choose LEFT or RIGHT to be master and output signal:
right->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
left->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::OUTPUT);
color->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
this is my ouput for a while, no frames syncing:
[19443010F117E01200] [1.2.3] [1.630] [StereoDepth(7)] [info] Calibrated FOV 97.355965 is over 85 degrees, enabling distortion correction.
[19443010F117E01200] [1.2.3] [1.657] [StereoDepth(7)] [info] Rectification mesh loaded, will override camera intrinsics/extrinsics matrices
[19443010F117E01200] [1.2.3] [1.657] [StereoDepth(7)] [info] Depth baseline: '11.09005' cm, focal length: '562.6896'
[19443010F117E01200] [1.2.3] [1.657] [StereoDepth(7)] [info] Depth horizontal FOV: '64.2428', vertical FOV: '38.946762'
[19443010F117E01200] [1.2.3] [2.302] [system] [info] Memory Usage - DDR: 75.98 / 340.34 MiB, CMX: 2.11 / 2.50 MiB, LeonOS Heap: 59.82 / 77.23 MiB, LeonRT Heap: 5.01 / 41.14 MiB
[19443010F117E01200] [1.2.3] [2.302] [system] [info] Temperatures - Average: 44.64C, CSS: 45.77C, MSS 43.73C, UPA: 44.41C, DSS: 44.64C
[19443010F117E01200] [1.2.3] [2.302] [system] [info] Cpu Usage - LeonOS 43.88%, LeonRT: 18.19%
[19443010F117E01200] [1.2.3] [3.303] [system] [info] Memory Usage - DDR: 75.98 / 340.34 MiB, CMX: 2.11 / 2.50 MiB, LeonOS Heap: 59.82 / 77.23 MiB, LeonRT Heap: 5.01 / 41.14 MiB
[19443010F117E01200] [1.2.3] [3.303] [system] [info] Temperatures - Average: 45.04C, CSS: 46.00C, MSS 44.87C, UPA: 44.87C, DSS: 44.41C
[19443010F117E01200] [1.2.3] [3.303] [system] [info] Cpu Usage - LeonOS 39.60%, LeonRT: 9.64%
[19443010F117E01200] [1.2.3] [4.304] [system] [info] Memory Usage - DDR: 75.98 / 340.34 MiB, CMX: 2.11 / 2.50 MiB, LeonOS Heap: 59.82 / 77.23 MiB, LeonRT Heap: 5.01 / 41.14 MiB
[19443010F117E01200] [1.2.3] [4.304] [system] [info] Temperatures - Average: 45.60C, CSS: 46.68C, MSS 45.09C, UPA: 45.55C, DSS: 45.09C
[19443010F117E01200] [1.2.3] [4.304] [system] [info] Cpu Usage - LeonOS 39.63%, LeonRT: 9.66%
[19443010F117E01200] [1.2.3] [5.305] [system] [info] Memory Usage - DDR: 75.98 / 340.34 MiB, CMX: 2.11 / 2.50 MiB, LeonOS Heap: 59.82 / 77.23 MiB, LeonRT Heap: 5.01 / 41.14 MiB
[19443010F117E01200] [1.2.3] [5.305] [system] [info] Temperatures - Average: 45.43C, CSS: 46.68C, MSS 44.87C, UPA: 45.55C, DSS: 44.64C
[19443010F117E01200] [1.2.3] [5.305] [system] [info] Cpu Usage - LeonOS 39.38%, LeonRT: 9.64%
...
Only works if i choose IMX, color as master, DIFF are in micros:
right->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
left->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::INPUT);
color->initialControl.setFrameSyncMode(dai::CameraControl::FrameSyncMode::OUTPUT);
DIFF: 425
DIFF: 418
DIFF: 406
DIFF: 404
DIFF: 407
DIFF: 407
DIFF: 67063
DIFF: 133719
[19443010F117E01200] [1.2.3] [2.309] [system] [info] Memory Usage - DDR: 75.98 / 340.34 MiB, CMX: 2.11 / 2.50 MiB, LeonOS Heap: 59.82 / 77.23 MiB, LeonRT Heap: 5.01 / 41.14 MiB
[19443010F117E01200] [1.2.3] [2.309] [system] [info] Temperatures - Average: 43.96C, CSS: 45.32C, MSS 43.73C, UPA: 43.27C, DSS: 43.50C
[19443010F117E01200] [1.2.3] [2.309] [system] [info] Cpu Usage - LeonOS 59.31%, LeonRT: 23.73%
DIFF: 167044
DIFF: 200368
DIFF: 267023
DIFF: 300349
DIFF: 333677
DIFF: 366998
DIFF: 400326
DIFF: 433651
DIFF: 466985
DIFF: 500303
DIFF: 533625
DIFF: 566953
DIFF: 533617
DIFF: 533616
but as you can see frame timestamp difference reach 600ms and no sync at all. I try to reduce fps but no luck, other important thing is this line:
pipeline.getDeviceConfig().board.gpio[6] = dai::BoardConfig::GPIO(dai::BoardConfig::GPIO::Direction::OUTPUT, dai::BoardConfig::GPIO::Level::HIGH);
dai::Device device(pipeline);
I try to change order, but nothing happends. Can anyone point me?
Thanks