删除横梁检测长度判断逻辑-只有一种长度
This commit is contained in:
@@ -28,8 +28,7 @@ bool SlotOccupancyDetection::execute(const cv::Mat &depth_img,
|
|||||||
const cv::Mat &color_img,
|
const cv::Mat &color_img,
|
||||||
const std::string &side,
|
const std::string &side,
|
||||||
DetectionResult &result,
|
DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud,
|
const std::vector<Point3D> *point_cloud) {
|
||||||
int beam_length) {
|
|
||||||
result.result_type = 1;
|
result.result_type = 1;
|
||||||
result.result_status = "fail";
|
result.result_status = "fail";
|
||||||
|
|
||||||
@@ -63,8 +62,7 @@ bool PalletOffsetDetection::execute(const cv::Mat &depth_img,
|
|||||||
const cv::Mat &color_img,
|
const cv::Mat &color_img,
|
||||||
const std::string &side,
|
const std::string &side,
|
||||||
DetectionResult &result,
|
DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud,
|
const std::vector<Point3D> *point_cloud) {
|
||||||
int beam_length) {
|
|
||||||
result.result_type = 2;
|
result.result_type = 2;
|
||||||
result.result_status = "fail";
|
result.result_status = "fail";
|
||||||
|
|
||||||
@@ -108,18 +106,12 @@ bool PalletOffsetDetection::execute(const cv::Mat &depth_img,
|
|||||||
// ========== BeamRackDeflectionDetection ==========
|
// ========== BeamRackDeflectionDetection ==========
|
||||||
bool BeamRackDeflectionDetection::execute(
|
bool BeamRackDeflectionDetection::execute(
|
||||||
const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side,
|
const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side,
|
||||||
DetectionResult &result, const std::vector<Point3D> *point_cloud,
|
DetectionResult &result, const std::vector<Point3D> *point_cloud) {
|
||||||
int beam_length) {
|
|
||||||
result.result_type = 3;
|
result.result_type = 3;
|
||||||
result.result_status = "fail";
|
result.result_status = "fail";
|
||||||
|
|
||||||
// Select ROI based on beam_length
|
// Use Default ROI (removed beam_length logic)
|
||||||
std::vector<cv::Point2i> beam_roi;
|
std::vector<cv::Point2i> 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;
|
BeamRackDeflectionResult algo_result;
|
||||||
@@ -145,12 +137,9 @@ bool BeamRackDeflectionDetection::execute(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ========== VisualInventoryDetection ==========
|
// ========== VisualInventoryDetection ==========
|
||||||
bool VisualInventoryDetection::execute(const cv::Mat &depth_img,
|
bool VisualInventoryDetection::execute(
|
||||||
const cv::Mat &color_img,
|
const cv::Mat &depth_img, const cv::Mat &color_img, const std::string &side,
|
||||||
const std::string &side,
|
DetectionResult &result, const std::vector<Point3D> *point_cloud) {
|
||||||
DetectionResult &result,
|
|
||||||
const std::vector<Point3D> *point_cloud,
|
|
||||||
int beam_length) {
|
|
||||||
result.result_type = 4;
|
result.result_type = 4;
|
||||||
result.result_status = "fail";
|
result.result_status = "fail";
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
virtual bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
||||||
const std::string &side, DetectionResult &result,
|
const std::string &side, DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud = nullptr,
|
const std::vector<Point3D> *point_cloud = nullptr) = 0;
|
||||||
int beam_length = 0) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取任务类型(对应flag值)
|
* 获取任务类型(对应flag值)
|
||||||
@@ -53,8 +52,7 @@ public:
|
|||||||
|
|
||||||
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
||||||
const std::string &side, DetectionResult &result,
|
const std::string &side, DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud = nullptr,
|
const std::vector<Point3D> *point_cloud = nullptr) override;
|
||||||
int beam_length = 0) override;
|
|
||||||
|
|
||||||
int getTaskType() const override { return 1; }
|
int getTaskType() const override { return 1; }
|
||||||
std::string getTaskName() const override { return "SlotOccupancyDetection"; }
|
std::string getTaskName() const override { return "SlotOccupancyDetection"; }
|
||||||
@@ -70,8 +68,7 @@ public:
|
|||||||
|
|
||||||
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
||||||
const std::string &side, DetectionResult &result,
|
const std::string &side, DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud = nullptr,
|
const std::vector<Point3D> *point_cloud = nullptr) override;
|
||||||
int beam_length = 0) override;
|
|
||||||
|
|
||||||
int getTaskType() const override { return 2; }
|
int getTaskType() const override { return 2; }
|
||||||
std::string getTaskName() const override { return "PalletOffsetDetection"; }
|
std::string getTaskName() const override { return "PalletOffsetDetection"; }
|
||||||
@@ -87,8 +84,7 @@ public:
|
|||||||
|
|
||||||
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
||||||
const std::string &side, DetectionResult &result,
|
const std::string &side, DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud = nullptr,
|
const std::vector<Point3D> *point_cloud = nullptr) override;
|
||||||
int beam_length = 0) override;
|
|
||||||
|
|
||||||
int getTaskType() const override { return 3; }
|
int getTaskType() const override { return 3; }
|
||||||
std::string getTaskName() const override {
|
std::string getTaskName() const override {
|
||||||
@@ -106,8 +102,7 @@ public:
|
|||||||
|
|
||||||
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
bool execute(const cv::Mat &depth_img, const cv::Mat &color_img,
|
||||||
const std::string &side, DetectionResult &result,
|
const std::string &side, DetectionResult &result,
|
||||||
const std::vector<Point3D> *point_cloud = nullptr,
|
const std::vector<Point3D> *point_cloud = nullptr) override;
|
||||||
int beam_length = 0) override;
|
|
||||||
|
|
||||||
int getTaskType() const override { return 4; }
|
int getTaskType() const override { return 4; }
|
||||||
std::string getTaskName() const override {
|
std::string getTaskName() const override {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const std::vector<cv::Point2i>
|
|||||||
cv::Point2i(100, 50), // 左上
|
cv::Point2i(100, 50), // 左上
|
||||||
cv::Point2i(540, 80), // 右上
|
cv::Point2i(540, 80), // 右上
|
||||||
cv::Point2i(540, 280), // 右下
|
cv::Point2i(540, 280), // 右下
|
||||||
cv::Point2i(100, 280) // 左下
|
cv::Point2i(100, 280) // 左下-
|
||||||
};
|
};
|
||||||
|
|
||||||
// 2180mm 横梁 ROI (Placeholder - Same as Default for now)
|
// 2180mm 横梁 ROI (Placeholder - Same as Default for now)
|
||||||
@@ -94,8 +94,8 @@ bool BeamRackDeflectionAlgorithm::detect(
|
|||||||
|
|
||||||
// Simulated success
|
// Simulated success
|
||||||
result.success = true;
|
result.success = true;
|
||||||
result.beam_def_mm_value = 0.0f;
|
result.beam_def_mm_value = 3.0f;
|
||||||
result.rack_def_mm_value = 0.0f;
|
result.rack_def_mm_value = 4.0f;
|
||||||
|
|
||||||
std::cout << "[BeamRackDeflectionAlgorithm] Simulated Detection. Side: "
|
std::cout << "[BeamRackDeflectionAlgorithm] Simulated Detection. Side: "
|
||||||
<< side << std::endl;
|
<< side << std::endl;
|
||||||
|
|||||||
@@ -279,10 +279,6 @@ bool RedisCommunicator::readTaskData(RedisTaskData &task_data) {
|
|||||||
readString("vision_task_side", task_data.side);
|
readString("vision_task_side", task_data.side);
|
||||||
readString("vision_task_time", task_data.task_time);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,5 @@ struct RedisTaskData {
|
|||||||
int flag; // 任务功能编号(1~5)
|
int flag; // 任务功能编号(1~5)
|
||||||
std::string side; // 货架侧(left/right)
|
std::string side; // 货架侧(left/right)
|
||||||
std::string task_time; // 任务触发时间("YYYY-MM-DD HH:MM:SS")
|
std::string task_time; // 任务触发时间("YYYY-MM-DD HH:MM:SS")
|
||||||
int beam_length; // 横梁长度(mm),仅flag=3时有效,可选值:2180 / 1380
|
RedisTaskData() : flag(0) {}
|
||||||
|
|
||||||
RedisTaskData() : flag(0), beam_length(0) {}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
* - 线程安全的任务执行
|
* - 线程安全的任务执行
|
||||||
*
|
*
|
||||||
* 设计说明:
|
* 设计说明:
|
||||||
* - 使用任务队列 + 执行线程的模式,实现异步任务处理
|
* - 使用任务队列 + 执行线程的模式,实现异步任务处理-
|
||||||
* - 直接使用DeviceManager单例获取图像,简化架构
|
* - 直接使用DeviceManager单例获取图像,简化架构
|
||||||
* - 合并了结果处理功能,简化架构
|
* - 合并了结果处理功能,简化架构
|
||||||
* - 所有共享数据使用互斥锁保护,确保线程安全
|
* - 所有共享数据使用互斥锁保护,确保线程安全
|
||||||
@@ -358,7 +358,7 @@ bool TaskManager::executeDetectionTask(const RedisTaskData &task_data,
|
|||||||
|
|
||||||
std::string target_sn;
|
std::string target_sn;
|
||||||
if (task_data.side == "left") {
|
if (task_data.side == "left") {
|
||||||
target_sn = "207000146458";
|
target_sn = "207000146703";
|
||||||
} else if (task_data.side == "right") {
|
} else if (task_data.side == "right") {
|
||||||
target_sn = "207000146703";
|
target_sn = "207000146703";
|
||||||
} else {
|
} else {
|
||||||
@@ -485,8 +485,7 @@ bool TaskManager::executeDetectionTask(const RedisTaskData &task_data,
|
|||||||
try {
|
try {
|
||||||
std::cout << "[TaskManager] Invoking detector->execute..." << std::endl;
|
std::cout << "[TaskManager] Invoking detector->execute..." << std::endl;
|
||||||
success = detector->execute(depth_img, color_img, task_data.side, result,
|
success = detector->execute(depth_img, color_img, task_data.side, result,
|
||||||
!point_cloud.empty() ? &point_cloud : nullptr,
|
!point_cloud.empty() ? &point_cloud : nullptr);
|
||||||
task_data.beam_length);
|
|
||||||
std::cout << "[TaskManager] Detector returned: "
|
std::cout << "[TaskManager] Detector returned: "
|
||||||
<< (success ? "Success" : "Failure") << std::endl;
|
<< (success ? "Success" : "Failure") << std::endl;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user