This commit is contained in:
Robofish 2026-01-03 16:28:54 +08:00
parent 3290b490b9
commit 170a2d2d42
96 changed files with 100 additions and 106 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -1 +1 @@
0.7177201718666837 0.09187038370024973 0.09699144216061435 -0.6833961132769422 0.7945099292803862 -0.0434575467108611 0.07481947984239669 0.601055288093252

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

After

Width:  |  Height:  |  Size: 218 KiB

View File

@ -1 +1 @@
0.6540393670774336 0.11673220229558735 0.104104730295333 -0.74011371044611 0.8320261217979533 -0.010711187380915883 0.034853447736525024 0.5535368463721503

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -1 +1 @@
0.6695365068706467 0.11396525651605409 0.10689676647567184 -0.7261582937567594 0.8173712544780483 -0.011828605094770673 0.03328423249804994 0.5750273700629471

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -1 +1 @@
0.6865027206257972 0.11121980925498735 0.10959354583553703 -0.7101643635904696 0.7984894363309989 -0.013758457040363277 0.032468299086838105 0.6009751529656445

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

After

Width:  |  Height:  |  Size: 215 KiB

View File

@ -1 +1 @@
0.7029618311310923 0.10910831122785473 0.114008892573956 -0.693499828989083 0.7800486898114236 -0.012651950562476097 0.03220614946153963 0.624761341319473

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 215 KiB

View File

@ -1 +1 @@
0.6846990959849547 0.11378336536460135 0.1095621509728064 -0.7115030771528001 0.7710456452265627 -0.02186493764130126 0.04513486486644217 0.6348018442416371

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 202 KiB

View File

@ -1 +1 @@
0.7105886427866503 0.09454929951290965 0.09772990470338523 -0.6903427238922067 0.7916711278986903 -0.07209407556694548 0.11214836806575476 0.5962231235535496

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 202 KiB

View File

@ -1 +1 @@
0.7082004773279313 0.09457995680211755 0.09737030792091227 -0.6928388981712751 0.8045946318607127 -0.06785936367345102 0.11352663362431434 0.5789078411981385

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 203 KiB

View File

@ -1 +1 @@
0.6864091145945169 0.08696336166250927 0.08462036719328926 -0.7170211256204378 0.8215749957916847 -0.06455802999670587 0.11384191417076965 0.5548754866010687

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

After

Width:  |  Height:  |  Size: 206 KiB

View File

@ -1 +1 @@
0.6667428632979302 0.10364170157370939 0.0955403079117792 -0.7318363215229934 0.8368116765764088 -0.06352479955713666 0.11690362951903568 0.5310784868471715

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 209 KiB

View File

@ -1 +1 @@
0.6608952401030105 0.0924475886118082 0.08181877213214009 -0.7402544248404296 0.7659234104878251 -0.05152390626763256 0.07971188746430936 0.6358872788053714

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -1 +1 @@
0.7258014151886103 0.06893544090588102 0.07336676467256588 -0.6804980003929494 0.7711539361232197 -0.04474533855113315 0.07190790375467529 0.6309902652634334

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 203 KiB

View File

@ -1 +1 @@
0.6368114936681568 0.09604567438504773 0.07995934840288652 -0.7608237986334537 0.7843599785188415 -0.07036673754547611 0.10757796487882619 0.6068401171788649

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 199 KiB

View File

@ -1 +1 @@
0.6572286496356463 0.07285829130720428 0.06370958053012925 -0.7474511762212797 0.8107296801983674 -0.06562048651309176 0.11368406086180097 0.5705149180356358

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 211 KiB

View File

@ -1 +1 @@
0.6350787937658589 0.07596458908813118 0.06184461820780068 -0.7662111654839704 0.7935983038966267 -0.033809170582879966 0.06190002705631246 0.6043401845710105

BIN
assets/camera_calib/23.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

View File

@ -0,0 +1 @@
0.8237228560732456 -0.030521906459115355 0.06638363742866517 0.5622653130777103

BIN
assets/camera_calib/24.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -0,0 +1 @@
0.8491398787146873 -0.025532247411769002 0.05836177108338319 0.5243123824539347

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -1 +1 @@
0.7153160451022573 0.06679164379924944 0.06815692277445147 -0.6922546249869169 0.7548850619033333 -0.047418777216818586 0.07093119403444739 0.650283606279068

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 207 KiB

View File

@ -1 +1 @@
0.6895526075414257 0.07227717802997588 0.06701324523260725 -0.7174973421081351 0.7591377331693356 -0.04763573374267206 0.07336706642951026 0.6450255905875732

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -1 +1 @@
0.6755160976098915 0.06749445326901966 0.0605731820592963 -0.7317468074840031 0.7583547886588434 -0.022422481447733462 0.044038113363287834 0.6499660694338815

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

After

Width:  |  Height:  |  Size: 213 KiB

View File

@ -1 +1 @@
0.6554968212916839 0.0710136384754573 0.06108937801660896 -0.7493657773881318 0.7789208034949294 -0.021997736668215327 0.048119363872661865 0.624886396303184

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

After

Width:  |  Height:  |  Size: 205 KiB

View File

@ -1 +1 @@
0.6453150221921371 0.08754614426431993 0.07488900209128711 -0.7551793377227582 0.8037386906226677 -0.020333318885384567 0.048369913784180284 0.5926643441103707

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 216 KiB

View File

@ -1 +1 @@
0.6436936453206352 0.1018123504027431 0.08674315464388545 -0.7535040553319725 0.8256625130752344 -0.020650051549974013 0.04936930246923488 0.5616205675070786

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

After

Width:  |  Height:  |  Size: 216 KiB

View File

@ -1 +1 @@
0.6409116406794043 0.11242770296004105 0.09554048153994232 -0.7533022612709181 0.8377166207827541 -0.020123362855542434 0.049144700467202415 0.5435169840471376

2
cali.MD Normal file
View File

@ -0,0 +1,2 @@
./build/capture configs/calibration.yaml -o assets/camera_calib
./build/calibrate_camera assets/camera_calib

View File

@ -2,21 +2,23 @@ pattern_cols: 10
pattern_rows: 7 pattern_rows: 7
center_distance_mm: 39 center_distance_mm: 39
# 重投影误差: 0.0833px # 重投影误差: 0.0840px
camera_matrix: [1824.3445767434343, 0, 745.88898611634079, 0, 1828.9000780816298, 584.45884364277663, 0, 0, 1] camera_matrix: [1834.1536403391224, 0, 748.34431374203518, 0, 1838.4254732917539, 592.07179931054554, 0, 0, 1]
distort_coeffs: [-0.084922638867033884, 0.22051971879198334, -0.00021700148630802023, 0.00043485717343934131, 0] distort_coeffs: [-0.089753587550662386, 0.25043670633576026, 0.00028701704204080067, 0.00026068590699182429, 0]
R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1] R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1]
# 相机同理想情况的偏角: yaw174.40 pitch8.20 roll178.20 degree # 相机同理想情况的偏角: yaw0.65 pitch0.98 roll-4.71 degree
R_camera2gimbal: [0.093296993396547734, 0.14503826005617809, -0.9850175501700672, -0.99514483056044212, -0.017561170025079953, -0.096841992524828474, -0.03134385477239883, 0.98927018980015091, 0.14269567036452102] # 标定板到世界坐标系原点的水平距离: 1.20 m
t_camera2gimbal: [-0.11903236791933375, -0.012143601357090483, -0.023682825149991701] # 标定板同竖直摆放时的偏角: yaw76.91 pitch5.90 roll-4.25 degree
R_camera2gimbal: [-0.012713492697510044, 0.016094161023931495, 0.99978965041870982, -0.9965458575215137, -0.082265286272855259, -0.011347974760117781, 0.082065345671248222, -0.99648050691189183, 0.017084448614971628]
t_camera2gimbal: [0.099890931342671643, 0.0015513845612699661, 0.048389617922529167]
#####-----gimbal参数-----##### #####-----gimbal参数-----#####
com_port: "/dev/ttyACM0" com_port: "/dev/ttyACM0"
camera_name: "hikrobot" camera_name: "hikrobot"
exposure_ms: 50 exposure_ms: 20
gain: 50.0 gain: 50.0
vid_pid: "2bdf:0001" vid_pid: "2bdf:0001"

View File

@ -1,7 +1,6 @@
enemy_color: "red" enemy_color: "red"
# enemy_color: "blue" # enemy_color: "blue"
#####-----神经网络参数-----##### #####-----神经网络参数-----#####
yolo_name: yolov5 yolo_name: yolov5
classify_model: assets/tiny_resnet.onnx classify_model: assets/tiny_resnet.onnx
@ -9,8 +8,8 @@ yolo11_model_path: assets/yolo11.xml
yolov8_model_path: assets/yolov8.xml yolov8_model_path: assets/yolov8.xml
yolov5_model_path: assets/yolov5.xml yolov5_model_path: assets/yolov5.xml
device: GPU device: GPU
min_confidence: 0.8 min_confidence: 0.75
use_traditional: false use_traditional: true
#####-----ROI-----##### #####-----ROI-----#####
roi: roi:
@ -21,24 +20,6 @@ roi:
use_roi: false use_roi: false
#####-----USB相机参数-----#####
image_width: 1280
image_height: 720
fov_h: 57.7 #87.7
fov_v: 56.7
new_fov_h: 27 #67
new_fov_v: 40.9
usb_frame_rate: 120
usb_exposure: 500 #1-80000______250
usb_gamma: 160
usb_gain: 10 #0-96
#####-----工业相机参数-----#####
camera_name: "hikrobot"
exposure_ms: 0.8
gain: 16.9
vid_pid: "2bdf:0001"
#####-----传统方法参数-----##### #####-----传统方法参数-----#####
threshold: 150 threshold: 150
max_angle_error: 45 # degree max_angle_error: 45 # degree
@ -49,48 +30,71 @@ min_armor_ratio: 1
max_armor_ratio: 5 max_armor_ratio: 5
max_side_ratio: 1.5 max_side_ratio: 1.5
max_rectangular_error: 25 # degree max_rectangular_error: 25 # degree
min_confidence: 0.8
#####-----cboard参数-----#####
quaternion_canid: 0x01
bullet_speed_canid: 0x110
send_canid: 0xff
can_interface: "can0"
#####-----tracker参数-----##### #####-----tracker参数-----#####
min_detect_count: 5 min_detect_count: 5
max_temp_lost_count: 25 max_temp_lost_count: 15
outpost_max_temp_lost_count: 75 outpost_max_temp_lost_count: 75
#####-----aimer参数-----##### #####-----aimer参数-----#####
yaw_offset: -0.8 # degree -2.5 yaw_offset: 2 # degree -2.5
pitch_offset: -1 # degree 2 pitch_offset: -6.5 # degree 2
comming_angle: 60 # degree comming_angle: 55 # degree
leaving_angle: 20 # degree leaving_angle: 20 # degree
left_yaw_offset: -1 decision_speed: 7 # rad/s
right_yaw_offset: -0.6 high_speed_delay_time: 0.0 # s
decision_speed: 10 # rad/s low_speed_delay_time: 0.0 # s planner use this value
high_speed_delay_time: 0.026 # s
low_speed_delay_time: 0.010 # s
#####-----shooter参数-----##### #####-----shooter参数-----#####
first_tolerance: 5 # 近距离射击容差degree first_tolerance: 3 # 近距离射击容差degree
second_tolerance: 2 # 远距离射击容差degree second_tolerance: 2 # 远距离射击容差degree
judge_distance: 3 #距离判断阈值 judge_distance: 2 #距离判断阈值
auto_fire: true # 是否由自瞄控制射击 auto_fire: true # 是否由自瞄控制射击
#####-----decider参数-----##### camera_name: "hikrobot"
mode: 1 exposure_ms: 2.5
gain: 16.9
vid_pid: "2bdf:0001"
# 重投影误差: 0.0840px
camera_matrix: [1834.1536403391224, 0, 748.34431374203518, 0, 1838.4254732917539, 592.07179931054554, 0, 0, 1]
distort_coeffs: [-0.089753587550662386, 0.25043670633576026, 0.00028701704204080067, 0.00026068590699182429, 0]
#####-----工业相机标定参数-----#####
R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1] R_gimbal2imubody: [1, 0, 0, 0, 1, 0, 0, 0, 1]
# 重投影误差: 0.1833px # 相机同理想情况的偏角: yaw0.65 pitch0.98 roll-4.71 degree
camera_matrix: [2414.9359264386621, 0, 717.26243105567414, 0, 2418.0489262208148, 582.68540529942845, 0, 0, 1]
distort_coeffs: [-0.0209453389287673, 0.15028138841073832, -0.0006517722113234505, -0.0016861906197686788, 0]
# 相机同理想情况的偏角: yaw-1.11 pitch0.01 roll-0.06 degree
# 标定板到世界坐标系原点的水平距离: 1.20 m # 标定板到世界坐标系原点的水平距离: 1.20 m
# 标定板同竖直摆放时的偏角: yaw123.89 pitch14.05 roll-0.86 degree # 标定板同竖直摆放时的偏角: yaw76.91 pitch5.90 roll-4.25 degree
R_camera2gimbal: [0.01928451708725664, 0.00012696140743255463, 0.99981402834802846, -0.99981344688553653, -0.0010834913551969569, 0.019284643459122196, 0.0010857382619952124, -0.99999940496346484, 0.00010604311483339372] R_camera2gimbal: [-0.012713492697510044, 0.016094161023931495, 0.99978965041870982, -0.9965458575215137, -0.082265286272855259, -0.011347974760117781, 0.082065345671248222, -0.99648050691189183, 0.017084448614971628]
t_camera2gimbal: [0.13089617453251859, 0.0038468007459533785, 0.094139945222010288] t_camera2gimbal: [0.099890931342671643, 0.0015513845612699661, 0.048389617922529167]
#####-----cboard参数-----#####
quaternion_canid: 0x100
bullet_speed_canid: 0x101
send_canid: 0xff
can_interface: "can0"
#####-----gimbal参数-----#####
com_port: "/dev/ttyUSB0"
yaw_kp: 0
yaw_kd: 0
pitch_kp: 0
pitch_kd: 0
#####-----planner-----#####
fire_thresh: 0.0035
max_yaw_acc: 50
Q_yaw: [9e6, 0]
R_yaw: [1]
max_pitch_acc: 100
Q_pitch: [9e6, 0]
R_pitch: [1]
#####-----buff_detector参数-----#####
model: "assets/yolo11_buff_int8.xml"
#####-----buff_aimer参数-----#####
fire_gap_time: 0.700 # s
predict_time: 0.120 # s

View File

@ -199,11 +199,11 @@ void Gimbal::read_thread()
// float bullet_speed = rx_data_.bullet_speed; // float bullet_speed = rx_data_.bullet_speed;
// uint16_t bullet_count = rx_data_.bullet_count, crc16 = rx_data_.crc16; // uint16_t bullet_count = rx_data_.bullet_count, crc16 = rx_data_.crc16;
tools::logger()->debug( // tools::logger()->debug(
"[Gimbal] mode: {}, q: [{:.3f}, {:.3f}, {:.3f}, {:.3f}], yaw: {:.3f}, yaw_vel: {:.3f}, " // "[Gimbal] mode: {}, q: [{:.3f}, {:.3f}, {:.3f}, {:.3f}], yaw: {:.3f}, yaw_vel: {:.3f}, "
"pitch: {:.3f}, pitch_vel: {:.3f}, bullet_speed: {:.3f}, bullet_count: {}, crc16: {}", // "pitch: {:.3f}, pitch_vel: {:.3f}, bullet_speed: {:.3f}, bullet_count: {}, crc16: {}",
rx_data_.mode, q0, q1, q2, q3, yaw, yaw_vel, pitch, pitch_vel, bullet_speed, // rx_data_.mode, q0, q1, q2, q3, yaw, yaw_vel, pitch, pitch_vel, bullet_speed,
bullet_count, crc16); // bullet_count, crc16);
error_count = 0; error_count = 0;
Eigen::Quaterniond q(rx_data_.q[0], rx_data_.q[1], rx_data_.q[2], rx_data_.q[3]); Eigen::Quaterniond q(rx_data_.q[0], rx_data_.q[1], rx_data_.q[2], rx_data_.q[3]);
queue_.push({q, t}); queue_.push({q, t});

View File

@ -62,6 +62,12 @@ int main(int argc, char * argv[])
plan.control, plan.fire, plan.yaw, plan.yaw_vel, plan.yaw_acc, plan.pitch, plan.pitch_vel, plan.control, plan.fire, plan.yaw, plan.yaw_vel, plan.yaw_acc, plan.pitch, plan.pitch_vel,
plan.pitch_acc); plan.pitch_acc);
tools::logger()->info(
"Target: yaw={:.3f}, pitch={:.3f} | Plan: yaw={:.3f}, pitch={:.3f} | Control={}, Fire={} | "
"Bullet_speed={:.2f}m/s",
plan.target_yaw, plan.target_pitch, plan.yaw, plan.pitch, plan.control, plan.fire,
gs.bullet_speed);
auto fired = gs.bullet_count > last_bullet_count; auto fired = gs.bullet_count > last_bullet_count;
last_bullet_count = gs.bullet_count; last_bullet_count = gs.bullet_count;

View File

@ -1 +0,0 @@
0.7177201718666837 0.09187038370024973 0.09699144216061435 -0.6833961132769422

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

View File

@ -1 +0,0 @@
0.6540393670774336 0.11673220229558735 0.104104730295333 -0.74011371044611

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

View File

@ -1 +0,0 @@
0.6695365068706467 0.11396525651605409 0.10689676647567184 -0.7261582937567594

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

View File

@ -1 +0,0 @@
0.6865027206257972 0.11121980925498735 0.10959354583553703 -0.7101643635904696

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

View File

@ -1 +0,0 @@
0.7029618311310923 0.10910831122785473 0.114008892573956 -0.693499828989083

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

View File

@ -1 +0,0 @@
0.6846990959849547 0.11378336536460135 0.1095621509728064 -0.7115030771528001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

View File

@ -1 +0,0 @@
0.7105886427866503 0.09454929951290965 0.09772990470338523 -0.6903427238922067

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

View File

@ -1 +0,0 @@
0.7082004773279313 0.09457995680211755 0.09737030792091227 -0.6928388981712751

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

@ -1 +0,0 @@
0.6864091145945169 0.08696336166250927 0.08462036719328926 -0.7170211256204378

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

View File

@ -1 +0,0 @@
0.6667428632979302 0.10364170157370939 0.0955403079117792 -0.7318363215229934

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

View File

@ -1 +0,0 @@
0.6608952401030105 0.0924475886118082 0.08181877213214009 -0.7402544248404296

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 KiB

View File

@ -1 +0,0 @@
0.7258014151886103 0.06893544090588102 0.07336676467256588 -0.6804980003929494

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

View File

@ -1 +0,0 @@
0.6368114936681568 0.09604567438504773 0.07995934840288652 -0.7608237986334537

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

View File

@ -1 +0,0 @@
0.6572286496356463 0.07285829130720428 0.06370958053012925 -0.7474511762212797

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

View File

@ -1 +0,0 @@
0.6350787937658589 0.07596458908813118 0.06184461820780068 -0.7662111654839704

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

View File

@ -1 +0,0 @@
0.7153160451022573 0.06679164379924944 0.06815692277445147 -0.6922546249869169

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 KiB

View File

@ -1 +0,0 @@
0.6895526075414257 0.07227717802997588 0.06701324523260725 -0.7174973421081351

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

View File

@ -1 +0,0 @@
0.6755160976098915 0.06749445326901966 0.0605731820592963 -0.7317468074840031

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

View File

@ -1 +0,0 @@
0.6554968212916839 0.0710136384754573 0.06108937801660896 -0.7493657773881318

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 KiB

View File

@ -1 +0,0 @@
0.6453150221921371 0.08754614426431993 0.07488900209128711 -0.7551793377227582

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

View File

@ -1 +0,0 @@
0.6436936453206352 0.1018123504027431 0.08674315464388545 -0.7535040553319725

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 KiB

View File

@ -1 +0,0 @@
0.6409116406794043 0.11242770296004105 0.09554048153994232 -0.7533022612709181