diff --git a/Energy/HitWindmills/Serial/nucCommu.h b/Energy/HitWindmills/Serial/nucCommu.h index 02cca56954a4ce1c11c80dc9bb2bd4686507bc63..f15a1728310ed3aea38d732e436194ad797a4a59 100644 --- a/Energy/HitWindmills/Serial/nucCommu.h +++ b/Energy/HitWindmills/Serial/nucCommu.h @@ -24,8 +24,9 @@ typedef struct fp32 theta; // 4 5 6 7 r与z轴夹角,弧度制单位,范围0-PI fp32 phi; // 8 9 10 11 r在xy平面投影与x正方向夹角,范围0-2*PI fp32 r; // 12 13 14 15 目标与摄像机距离,单位 米 - uint16_t detectedColor; //16 17识别出来的目标物颜色 - uint16_t reserved[4]; //18 19 20 21 22 23 24 25保留位,用于以后制造全自动步兵时,单片机与nuc交互 + uint16_t nucSayWeShouldShootNow; //18 19 NUC传递的参数。uint16_t allowAutoShoot; 参考设计手册:操作手按住鼠标右键不放,在开启自瞄的情况下,才允许NUC控制发射 + //1表示发射,0表示不发射 + uint16_t reserved[3]; // 20 21 22 23 24 25保留位,用于以后制造全自动步兵时,单片机与nuc交互 uint16_t endFlag; //26 27 结束标志 } toSTM32_t; diff --git a/Energy/HitWindmills/Serial/sendDataToSTM.cpp b/Energy/HitWindmills/Serial/sendDataToSTM.cpp index 37245fa50154bfcd00f303107b540d8da2da4c8e..001458dc76451664258099ad5066e2a74672c09e 100644 --- a/Energy/HitWindmills/Serial/sendDataToSTM.cpp +++ b/Energy/HitWindmills/Serial/sendDataToSTM.cpp @@ -25,7 +25,8 @@ bool sendTargetData( fp32 phi, // 8 9 10 11 r鍦▁y骞抽潰鎶曞奖涓巟姝f柟鍚戝す瑙掞紝鑼冨洿0-2*PI fp32 r, // 12 13 14 15 鐩爣涓庢憚鍍忔満璺濈,鍗曚綅 绫 uint16_t detectedColor, //16 17璇嗗埆鍑烘潵鐨勭洰鏍囩墿棰滆壊 - int found //鎵惧埌銆1涓烘壘鍒颁簡瑁呯敳鏉匡紝0涓烘湭鎵惧埌瑁呯敳鏉 + int found, //鎵惧埌銆1涓烘壘鍒颁簡瑁呯敳鏉匡紝0涓烘湭鎵惧埌瑁呯敳鏉 + int shoot //鍙戝皠锛1涓哄彂灏勶紝0涓轰笉鍙戝皠 ) { // if(found) @@ -70,5 +71,6 @@ bool sendTargetData( sendBuff_all.r=r; sendBuff_all.detectedColor=detectedColor; sendBuff_all.endFlag=SEND_END; + sendBuff_all.nucSayWeShouldShootNow = shoot; return serial.WriteData(sendBuffForceAll,sizeof(toSTM32_t)); } diff --git a/Energy/HitWindmills/Serial/sendDataToSTM.h b/Energy/HitWindmills/Serial/sendDataToSTM.h index 6bd1bbcf8b82b8ae52eb5a560975ce35ba70109b..5369bff50c9e1416037656a244db5c67c45a6234 100644 --- a/Energy/HitWindmills/Serial/sendDataToSTM.h +++ b/Energy/HitWindmills/Serial/sendDataToSTM.h @@ -20,7 +20,8 @@ bool sendTargetData( fp32 phi, // 8 9 10 11 r鍦▁y骞抽潰鎶曞奖涓巟姝f柟鍚戝す瑙掞紝鑼冨洿0-2*PI fp32 r, // 12 13 14 15 鐩爣涓庢憚鍍忔満璺濈,鍗曚綅 绫 uint16_t detectedColor, //16 17璇嗗埆鍑烘潵鐨勭洰鏍囩墿棰滆壊 - int found //鎵惧埌銆1涓烘壘鍒颁簡瑁呯敳鏉匡紝0涓烘湭鎵惧埌瑁呯敳鏉 + int found, //鎵惧埌銆1涓烘壘鍒颁簡瑁呯敳鏉匡紝0涓烘湭鎵惧埌瑁呯敳鏉 + int shoot //鍙戝皠锛1涓哄彂灏勶紝0涓轰笉鍙戝皠 ); #endif diff --git a/Energy/HitWindmills/main.cpp b/Energy/HitWindmills/main.cpp index f83f8df41564665f55954ee14fafd5d32e463d13..db709d4e9131102cfe9577a4961bca871a3341ae 100644 --- a/Energy/HitWindmills/main.cpp +++ b/Energy/HitWindmills/main.cpp @@ -284,12 +284,12 @@ int main(){ newSolver.solve(armor_Points, rrect.center, image.size(), yaw, pitch, r); cout << "Solved: yaw = " << yaw << "\tpitch = "<< pitch << "\tDistance = " << r << "m" << endl; - sendTargetData(pitch, yaw, r, COLOR_RED, 1); + sendTargetData(pitch, yaw, r, COLOR_RED, 1,1); //鍙戝皠 } } else{ // No target - sendTargetData(0.0f, 0.0f, 0.0f, COLOR_RED, 0); + sendTargetData(0.0f, 0.0f, 0.0f, COLOR_RED, 0,0); //涓嶅彂灏 } } #ifdef SHOWPIC diff --git a/Serial/nucCommu.h b/Serial/nucCommu.h index 02cca56954a4ce1c11c80dc9bb2bd4686507bc63..de673da9401d8c9f3c541c7af8acae3d6aef27be 100644 --- a/Serial/nucCommu.h +++ b/Serial/nucCommu.h @@ -25,7 +25,9 @@ typedef struct fp32 phi; // 8 9 10 11 r在xy平面投影与x正方向夹角,范围0-2*PI fp32 r; // 12 13 14 15 目标与摄像机距离,单位 米 uint16_t detectedColor; //16 17识别出来的目标物颜色 - uint16_t reserved[4]; //18 19 20 21 22 23 24 25保留位,用于以后制造全自动步兵时,单片机与nuc交互 + uint16_t nucSayWeShouldShootNow; //18 19 NUC传递的参数。uint16_t allowAutoShoot; 参考设计手册:操作手按住鼠标右键不放,在开启自瞄的情况下,才允许NUC控制发射 + //1表示发射,0表示不发射 + uint16_t reserved[3]; // 20 21 22 23 24 25保留位,用于以后制造全自动步兵时,单片机与nuc交互 uint16_t endFlag; //26 27 结束标志 } toSTM32_t;