diff --git a/image_capture/src/algorithm/core/detection_base.cpp b/image_capture/src/algorithm/core/detection_base.cpp index e7e8fb0..6dae509 100644 --- a/image_capture/src/algorithm/core/detection_base.cpp +++ b/image_capture/src/algorithm/core/detection_base.cpp @@ -28,8 +28,7 @@ bool SlotOccupancyDetection::execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud, - int beam_length) { + const std::vector *point_cloud) { result.result_type = 1; result.result_status = "fail"; @@ -63,8 +62,7 @@ bool PalletOffsetDetection::execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud, - int beam_length) { + const std::vector *point_cloud) { result.result_type = 2; result.result_status = "fail"; @@ -108,18 +106,12 @@ bool PalletOffsetDetection::execute(const cv::Mat &depth_img, // ========== BeamRackDeflectionDetection ========== bool BeamRackDeflectionDetection::execute( const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, - DetectionResult &result, const std::vector *point_cloud, - int beam_length) { + DetectionResult &result, const std::vector *point_cloud) { result.result_type = 3; result.result_status = "fail"; - // Select ROI based on beam_length + // Use Default ROI (removed beam_length logic) std::vector beam_roi; - if (beam_length == 2180) { - beam_roi = BeamRackDeflectionAlgorithm::BEAM_ROI_2180; - } else if (beam_length == 1380) { - beam_roi = BeamRackDeflectionAlgorithm::BEAM_ROI_1380; - } // 调用算法进行检测 BeamRackDeflectionResult algo_result; @@ -145,12 +137,9 @@ bool BeamRackDeflectionDetection::execute( } // ========== VisualInventoryDetection ========== -bool VisualInventoryDetection::execute(const cv::Mat &depth_img, - const cv::Mat &color_img, - const std::string &side, - DetectionResult &result, - const std::vector *point_cloud, - int beam_length) { +bool VisualInventoryDetection::execute( + const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, + DetectionResult &result, const std::vector *point_cloud) { result.result_type = 4; result.result_status = "fail"; diff --git a/image_capture/src/algorithm/core/detection_base.h b/image_capture/src/algorithm/core/detection_base.h index 59c0b3d..e9042c8 100644 --- a/image_capture/src/algorithm/core/detection_base.h +++ b/image_capture/src/algorithm/core/detection_base.h @@ -29,8 +29,7 @@ public: */ virtual bool execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud = nullptr, - int beam_length = 0) = 0; + const std::vector *point_cloud = nullptr) = 0; /** * 获取任务类型(对应flag值) @@ -53,8 +52,7 @@ public: bool execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud = nullptr, - int beam_length = 0) override; + const std::vector *point_cloud = nullptr) override; int getTaskType() const override { return 1; } std::string getTaskName() const override { return "SlotOccupancyDetection"; } @@ -70,8 +68,7 @@ public: bool execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud = nullptr, - int beam_length = 0) override; + const std::vector *point_cloud = nullptr) override; int getTaskType() const override { return 2; } std::string getTaskName() const override { return "PalletOffsetDetection"; } @@ -87,8 +84,7 @@ public: bool execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud = nullptr, - int beam_length = 0) override; + const std::vector *point_cloud = nullptr) override; int getTaskType() const override { return 3; } std::string getTaskName() const override { @@ -106,8 +102,7 @@ public: bool execute(const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side, DetectionResult &result, - const std::vector *point_cloud = nullptr, - int beam_length = 0) override; + const std::vector *point_cloud = nullptr) override; int getTaskType() const override { return 4; } std::string getTaskName() const override { diff --git a/image_capture/src/algorithm/detections/beam_rack_deflection/beam_rack_deflection_detection.cpp b/image_capture/src/algorithm/detections/beam_rack_deflection/beam_rack_deflection_detection.cpp index 408b806..5ae3cca 100644 --- a/image_capture/src/algorithm/detections/beam_rack_deflection/beam_rack_deflection_detection.cpp +++ b/image_capture/src/algorithm/detections/beam_rack_deflection/beam_rack_deflection_detection.cpp @@ -23,7 +23,7 @@ const std::vector cv::Point2i(100, 50), // 左上 cv::Point2i(540, 80), // 右上 cv::Point2i(540, 280), // 右下 - cv::Point2i(100, 280) // 左下 + cv::Point2i(100, 280) // 左下- }; // 2180mm 横梁 ROI (Placeholder - Same as Default for now) @@ -94,8 +94,8 @@ bool BeamRackDeflectionAlgorithm::detect( // Simulated success result.success = true; - result.beam_def_mm_value = 0.0f; - result.rack_def_mm_value = 0.0f; + result.beam_def_mm_value = 3.0f; + result.rack_def_mm_value = 4.0f; std::cout << "[BeamRackDeflectionAlgorithm] Simulated Detection. Side: " << side << std::endl; diff --git a/image_capture/src/redis/redis_communicator.cpp b/image_capture/src/redis/redis_communicator.cpp index 6249afc..05d8ba0 100644 --- a/image_capture/src/redis/redis_communicator.cpp +++ b/image_capture/src/redis/redis_communicator.cpp @@ -279,10 +279,6 @@ bool RedisCommunicator::readTaskData(RedisTaskData &task_data) { readString("vision_task_side", task_data.side); readString("vision_task_time", task_data.task_time); - int beam_length = 0; - readInt("vision_task_beam_length", beam_length); - task_data.beam_length = beam_length; - return true; } diff --git a/image_capture/src/redis/task_data.h b/image_capture/src/redis/task_data.h index 5a14288..d0904c8 100644 --- a/image_capture/src/redis/task_data.h +++ b/image_capture/src/redis/task_data.h @@ -10,7 +10,5 @@ struct RedisTaskData { int flag; // 任务功能编号(1~5) std::string side; // 货架侧(left/right) std::string task_time; // 任务触发时间("YYYY-MM-DD HH:MM:SS") - int beam_length; // 横梁长度(mm),仅flag=3时有效,可选值:2180 / 1380 - - RedisTaskData() : flag(0), beam_length(0) {} + RedisTaskData() : flag(0) {} }; diff --git a/image_capture/src/task/task_manager.cpp b/image_capture/src/task/task_manager.cpp index 3d49f9b..9fb2380 100644 --- a/image_capture/src/task/task_manager.cpp +++ b/image_capture/src/task/task_manager.cpp @@ -9,7 +9,7 @@ * - 线程安全的任务执行 * * 设计说明: - * - 使用任务队列 + 执行线程的模式,实现异步任务处理 + * - 使用任务队列 + 执行线程的模式,实现异步任务处理- * - 直接使用DeviceManager单例获取图像,简化架构 * - 合并了结果处理功能,简化架构 * - 所有共享数据使用互斥锁保护,确保线程安全 @@ -358,7 +358,7 @@ bool TaskManager::executeDetectionTask(const RedisTaskData &task_data, std::string target_sn; if (task_data.side == "left") { - target_sn = "207000146458"; + target_sn = "207000146703"; } else if (task_data.side == "right") { target_sn = "207000146703"; } else { @@ -485,8 +485,7 @@ bool TaskManager::executeDetectionTask(const RedisTaskData &task_data, try { std::cout << "[TaskManager] Invoking detector->execute..." << std::endl; success = detector->execute(depth_img, color_img, task_data.side, result, - !point_cloud.empty() ? &point_cloud : nullptr, - task_data.beam_length); + !point_cloud.empty() ? &point_cloud : nullptr); std::cout << "[TaskManager] Detector returned: " << (success ? "Success" : "Failure") << std::endl; } catch (const std::exception &e) {