From 8dc1faf2aeaa480f1d37735f0e3ba0eb5aadd682 Mon Sep 17 00:00:00 2001 From: Lizongdi <1210855344@qq.com> Date: Wed, 21 Oct 2026 15:39:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8A=E8=80=B3=E5=88=87=E5=89=B2=E3=80=90?= =?UTF-8?q?=E8=B0=83=E9=80=9A=E6=89=93=E6=A0=87=E3=80=91=E5=B7=A6=E5=8F=B3?= =?UTF-8?q?=E6=BB=91=E5=8F=B0=E7=94=A8=E5=8F=B3=E6=91=87=E6=9D=86=E5=B7=A6?= =?UTF-8?q?=E5=8F=B3=E6=8E=A7=E5=88=B6=EF=BC=8C=E9=80=9F=E5=BA=A6=E4=B8=BA?= =?UTF-8?q?1mm/s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.settings/language.settings.xml | 4 ++-- .../BHBF_Robot_Lifting_Lug.ioc | 2 +- .../Core/BASE/Inc/MSP/msp_LeiSai_485.h | 2 +- .../Core/BASE/Src/MSP/msp_LeiSai_485.c | 4 ++-- diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c | 12 ++++++++---- diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/usart.c | 2 +- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml index 29c5333..9ed3a24 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/BHBF_Robot_Lifting_Lug.ioc b/diaoerqiege/BHBF_Robot_Lifting_Lug/BHBF_Robot_Lifting_Lug.ioc index 445adbe..2204098 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/BHBF_Robot_Lifting_Lug.ioc +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/BHBF_Robot_Lifting_Lug.ioc @@ -878,7 +878,7 @@ USART3.FIFOMode=FIFOMODE_ENABLE USART3.IPParameters=VirtualMode-Asynchronous,DMADisableonRxErrorParam,OverrunDisableParam,FIFOMode,BaudRate USART3.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE USART3.VirtualMode-Asynchronous=VM_ASYNC -USART6.BaudRate=115200 +USART6.BaudRate=9600 USART6.DMADisableonRxErrorParam=ADVFEATURE_DMA_ENABLEONRXERROR USART6.FIFOMode=FIFOMODE_ENABLE USART6.IPParameters=VirtualMode,OverrunDisableParam,FIFOMode,DMADisableonRxErrorParam,BaudRate,SwapParam diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h index c596123..68d7c22 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_LeiSai_485.h @@ -11,6 +11,6 @@ -extern uint8_t LS_485Motors_Speed; +extern int16_t LS_485Motors_Speed; #endif /* BASE_INC_MSP_MSP_LEISAI_485_H_ */ diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c index d178b8e..53c25ac 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c @@ -12,8 +12,8 @@ struct UARTHandler *LS_485Motors_handler; DispacherController *LS_485Motors_dispacherController; -uint8_t LS_485Motors_slave_id = 0x00; //默认为0 广播形式 -uint8_t LS_485Motors_Speed=0; +uint8_t LS_485Motors_slave_id = 0x01; //默认为0 广播形式 +int16_t LS_485Motors_Speed=0; uint8_t speedModeSet=1; void LS_485Motor_loop(); diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c index 194e003..1ecf7d4 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c @@ -13,6 +13,7 @@ #include "robot_state.h" #include "bsp_TIMER.h" #include "msp_Strong_grinding_machine.h" +#include "msp_LeiSai_485.h" void action_perfrom(transition_t transitions[], int length, int state); @@ -460,13 +461,13 @@ void Frontend_Control() CurrentFrontEndState = Manual_UP_STATE; return; } - else if(P_MK32->CH3_LY_H > 100) + else if(P_MK32->CH0_RY_H > 100) { // 右转 if((angle >= -45) && (angle <=45)) { - - return; + LS_485Motors_Speed = 100; + return; } } // 后退 @@ -478,16 +479,18 @@ void Frontend_Control() // 左转 else if(((angle > 135) && (angle <= 180)) || (angle < -135) && (angle >= -179)) { - + LS_485Motors_Speed = -100; return; } else { + LS_485Motors_Speed = 0; CurrentFrontEndState = HALT_STATE; } } // 低速控制前端雷赛电机 else if(GV.MK32_Key.CH5_SB == -1000) { + LS_485Motors_Speed = 0; // 前进 if((angle >= 45) && (angle <= 135)) { @@ -521,6 +524,7 @@ void Frontend_Control() } else{ + LS_485Motors_Speed = 0; // 前进 if((angle >= 45) && (angle <= 135)) { diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/usart.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/usart.c index d7f9fdf..1256b6c 100644 --- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/usart.c +++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/usart.c @@ -372,7 +372,7 @@ void MX_USART6_UART_Init(void) /* USER CODE END USART6_Init 1 */ huart6.Instance = USART6; - huart6.Init.BaudRate = 115200; + huart6.Init.BaudRate = 9600; huart6.Init.WordLength = UART_WORDLENGTH_8B; huart6.Init.StopBits = UART_STOPBITS_1; huart6.Init.Parity = UART_PARITY_NONE;