#include "depthai/depthai.hpp" #include "rerun_node.hpp" int main() { using namespace std; // ULogger::setType(ULogger::kTypeConsole); // ULogger::setLevel(ULogger::kDebug); // Create pipeline dai::Pipeline pipeline; int width = 640; int height = 400; // Define sources and outputs auto left = pipeline.create()->build(dai::CameraBoardSocket::CAM_B); auto right = pipeline.create()->build(dai::CameraBoardSocket::CAM_C); auto stereo = pipeline.create(); auto imu = pipeline.create(); auto featureTracker = pipeline.create(); auto odom = pipeline.create(); auto rerun = pipeline.create(); auto params = rtabmap::ParametersMap(); params.insert(rtabmap::ParametersPair(rtabmap::Parameters::kOdomResetCountdown(), "30")); odom->setParams(params); imu->enableIMUSensor({dai::IMUSensor::ACCELEROMETER_RAW, dai::IMUSensor::GYROSCOPE_RAW}, 100); imu->setBatchReportThreshold(1); imu->setMaxBatchReports(10); featureTracker->setHardwareResources(1, 2); featureTracker->initialConfig->setCornerDetector(dai::FeatureTrackerConfig::CornerDetector::Type::SHI_THOMASI); featureTracker->initialConfig->setNumTargetFeatures(1000); featureTracker->initialConfig->setMotionEstimator(false); featureTracker->initialConfig->featureMaintainer.minimumDistanceBetweenFeatures = 49.0; stereo->setExtendedDisparity(false); stereo->setLeftRightCheck(true); stereo->setRectifyEdgeFillColor(0); // black, to better see the cutout stereo->enableDistortionCorrection(true); stereo->initialConfig->setLeftRightCheckThreshold(10); stereo->setDepthAlign(dai::StereoDepthProperties::DepthAlign::RECTIFIED_LEFT); // Linking left->requestOutput(std::make_pair(width, height))->link(stereo->left); right->requestOutput(std::make_pair(width, height))->link(stereo->right); stereo->rectifiedLeft.link(featureTracker->inputImage); featureTracker->passthroughInputImage.link(odom->rect); stereo->depth.link(odom->depth); imu->out.link(odom->imu); featureTracker->outputFeatures.link(odom->features); odom->transform.link(rerun->inputTrans); odom->passthroughRect.link(rerun->inputImg); pipeline.start(); pipeline.wait(); }