From f6c79e2f02f1094b7975b3032ea246bfe5b0f27e Mon Sep 17 00:00:00 2001 From: SeannaeS <9564773+seannaes@user.noreply.gitee.com> Date: Fri, 27 May 2022 22:29:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=B2?= =?UTF-8?q?=E5=8F=A3=E9=80=9A=E4=BF=A1=E5=8D=8F=E8=AE=AE=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86NUC=E6=8E=A7=E5=88=B6=E5=8F=91=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Serial/nucCommu.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Serial/nucCommu.h b/Serial/nucCommu.h index 02cca56..de673da 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; -- Gitee From d2762e48e3f4a1b6d1238d5a86dd81544e5c795d Mon Sep 17 00:00:00 2001 From: SeannaeS <9564773+seannaes@user.noreply.gitee.com> Date: Fri, 27 May 2022 22:32:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=83=BD?= =?UTF-8?q?=E9=87=8F=E6=9C=BA=E5=85=B3=E6=96=87=E4=BB=B6=E5=A4=B9=E4=B8=8B?= =?UTF-8?q?=E7=9A=84=E4=B8=B2=E5=8F=A3=E9=80=9A=E4=BF=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=87=BD=E6=95=B0=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?shoot=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Energy/HitWindmills/Serial/nucCommu.h | 5 +++-- Energy/HitWindmills/Serial/sendDataToSTM.cpp | 4 +++- Energy/HitWindmills/Serial/sendDataToSTM.h | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Energy/HitWindmills/Serial/nucCommu.h b/Energy/HitWindmills/Serial/nucCommu.h index 02cca56..f15a172 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 37245fa..001458d 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 6bd1bbc..5369bff 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 -- Gitee From 2cee58430958d1fc119d4e1ab9bb6fd32b62423c Mon Sep 17 00:00:00 2001 From: SeannaeS <9564773+seannaes@user.noreply.gitee.com> Date: Fri, 27 May 2022 22:35:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=83=BD=E9=87=8F?= =?UTF-8?q?=E6=9C=BA=E5=85=B3main=E5=87=BD=E6=95=B0=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=8F=91=E5=B0=84=E6=8E=A7=E5=88=B6=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Energy/HitWindmills/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Energy/HitWindmills/main.cpp b/Energy/HitWindmills/main.cpp index f83f8df..db709d4 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 -- Gitee