From 7d926dcd15d4b1aa68e8d93f08508a020e16f13f Mon Sep 17 00:00:00 2001 From: sph <1527550984@qq.com> Date: Sun, 17 Mar 2024 13:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4vofa=E5=86=85=E7=9A=84usb?= =?UTF-8?q?=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/master_machine/master_process.c | 7 ++++--- modules/master_machine/master_process.h | 11 ++++++++--- modules/vofa/vofa.c | 6 ++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/master_machine/master_process.c b/modules/master_machine/master_process.c index ce59852..6c00de1 100644 --- a/modules/master_machine/master_process.c +++ b/modules/master_machine/master_process.c @@ -143,7 +143,7 @@ static void DecodeVision(uint16_t recv_len) { if(VerifyCRC16CheckSum(vis_recv_buff,sizeof(recv_data))) { - DaemonReload(vision_daemon_instance); + DaemonReload(vision_daemon_instance); //喂狗 memcpy(&recv_data,vis_recv_buff,sizeof(recv_data)); } } @@ -180,8 +180,9 @@ void VisionSend() static uint8_t send_buffer[24]={0}; send_data.header = 0x5A; - //VisionSetFlag(1); - + VisionSetFlag(COLOR_BLUE); + //VisionSetAim(recv_data.x,recv_data.y,recv_data.z); + VisionSetAim(0,0,0); send_data.checksum = crc_16(&send_data.header,sizeof(send_data)-2); memcpy(send_buffer,&send_data,sizeof(send_data)); diff --git a/modules/master_machine/master_process.h b/modules/master_machine/master_process.h index 0675996..dcb1641 100644 --- a/modules/master_machine/master_process.h +++ b/modules/master_machine/master_process.h @@ -45,8 +45,8 @@ typedef enum { // COLOR_NONE = 0, // COLOR_BLUE = 1, // COLOR_RED = 2, - ENEMY_COLOR_RED = 0, - ENEMY_COLOR_BLUE = 1, + COLOR_RED = 0, + COLOR_BLUE = 1, } Enemy_Color_e; typedef enum { @@ -88,10 +88,12 @@ typedef struct { typedef struct { uint8_t header; //= 0xA5; + uint8_t tracking: 1; uint8_t id: 3; // 0-outpost 6-guard 7-base uint8_t armors_num: 3; // 2-balance 3-outpost 4-normal uint8_t reserved: 1; + // float x; // float y; // float z; @@ -103,9 +105,12 @@ typedef struct { // float r1; // float r2; // float dz; + + //导航数据 float nav_vx; float nav_vy; float nav_wz; + uint16_t checksum; } RecievePacket_t; #pragma pack() @@ -144,4 +149,4 @@ void VisionSetFlag(Enemy_Color_e enemy_color); void VisionSetAltitude(float yaw, float pitch); void VisionSetAim(float aim_x, float aim_y,float aim_z); -#endif // !MASTER_PROCESS_H +#endif // !MASTER_PROCESS_H \ No newline at end of file diff --git a/modules/vofa/vofa.c b/modules/vofa/vofa.c index 41526ea..26fe198 100644 --- a/modules/vofa/vofa.c +++ b/modules/vofa/vofa.c @@ -79,8 +79,6 @@ void ANODT_SendF1(int32_t Angle,int32_t speed_rpm,int32_t Angle_target,int32_t s DataSendBuf[cnt++]=sc; DataSendBuf[cnt++]=ac; -// for(uint8_t i=0;i