参考上海交大

This commit is contained in:
2025-12-05 11:24:23 +08:00
parent 3f60b1f564
commit b4c795f77d
44 changed files with 125 additions and 2295 deletions

View File

@@ -23,6 +23,23 @@ struct ArmorPlate {
double confidence;
std::pair<LightBar, LightBar> pair;
std::vector<cv::Point2f> corners_2d; // Can be computed later for 3D pose
// Function to get bounding rectangle of the armor plate
cv::Rect2d getBoundingRect() const {
if (corners_2d.size() >= 4) {
cv::Point2f min_pt = corners_2d[0];
cv::Point2f max_pt = corners_2d[0];
for (const auto& pt : corners_2d) {
min_pt.x = std::min(min_pt.x, pt.x);
min_pt.y = std::min(min_pt.y, pt.y);
max_pt.x = std::max(max_pt.x, pt.x);
max_pt.y = std::max(max_pt.y, pt.y);
}
return cv::Rect2d(min_pt.x, min_pt.y, max_pt.x - min_pt.x, max_pt.y - min_pt.y);
}
// Fallback: use center and a fixed size
return cv::Rect2d(center.x - 30, center.y - 15, 60, 30);
}
};
class ArmorDetector {

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3

View File

@@ -36,6 +36,9 @@ const float ARMOR_ANGLE_DIFF_THRESHOLD = 15.0f * CV_PI / 180.0f; // Armor light
const float KF_PROCESS_NOISE = 0.02f; // Process noise covariance
const float KF_MEASUREMENT_NOISE = 0.5f; // Measurement noise covariance
// Focal length in pixels (from camera calibration)
const double FOCAL_PIXAL = 600.0; // This should match your actual camera calibration
// TTL communication settings
const int TTL_BAUDRATE = 115200;