Files
Catalyst-MDVS/Catalyst-MDVS2/inc/config.h

45 lines
1.8 KiB
C

#ifndef CONFIG_H
#define CONFIG_H
#include <opencv2/opencv.hpp>
// Camera intrinsic parameters (need actual calibration)
const cv::Mat CAMERA_MATRIX = (cv::Mat_<float>(3, 3) <<
600, 0, 320,
0, 600, 240,
0, 0, 1);
const cv::Mat DIST_COEFFS = cv::Mat::zeros(5, 1, CV_32F); // Distortion coefficients (set to 0 for no distortion)
// Armor dimensions (in mm)
const float ARMOR_WIDTH = 135.0f;
const float ARMOR_HEIGHT = 125.0f;
const float ARMOR_THICKNESS = 20.0f;
const cv::Mat ARMOR_3D_POINTS = (cv::Mat_<float>(4, 3) <<
-ARMOR_WIDTH / 2, -ARMOR_HEIGHT / 2, 0,
ARMOR_WIDTH / 2, -ARMOR_HEIGHT / 2, 0,
ARMOR_WIDTH / 2, ARMOR_HEIGHT / 2, 0,
-ARMOR_WIDTH / 2, ARMOR_HEIGHT / 2, 0);
// Detection thresholds
const float HORIZONTAL_ANGLE_THRESHOLD = 25.0f; // Light bar horizontal angle threshold (degrees)
const float HORIZONTAL_ANGLE_THRESHOLD_RAD = HORIZONTAL_ANGLE_THRESHOLD * CV_PI / 180.0f;
const float NEARBY_LIGHT_BAR_THRESHOLD = 500.0f; // Light bar merging distance threshold (pixels)
const float LIGHT_BAR_IOU_THRESHOLD = 0.05f; // Light bar merging IOU threshold
const float ARMOR_DISTANCE_RATIO_MIN = 0.6f; // Armor light bar distance ratio range
const float ARMOR_DISTANCE_RATIO_MAX = 4.0f;
const float ARMOR_LENGTH_DIFF_RATIO = 0.5f; // Armor light bar length difference ratio
const float ARMOR_ANGLE_DIFF_THRESHOLD = 15.0f * CV_PI / 180.0f; // Armor light bar angle difference threshold (radians)
// Kalman filter parameters
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;
#endif // CONFIG_H