From 370002d221b790b00e840cbd28861fc0c713de0d Mon Sep 17 00:00:00 2001
From: "HJB\\13752" <13752551070@163.com>
Date: Mon, 30 Mar 2026 12:08:05 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=89=8D=E7=AB=AF=E5=BC=BA?=
=?UTF-8?q?=E7=A3=A8=E6=9C=BA=E6=8E=A7=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../.settings/language.settings.xml | 4 +-
.../Inc/MSP/msp_Strong_grinding_machine.h | 20 +++++
.../Src/MSP/msp_Strong_grinding_machine.c | 88 +++++++++++++++++++
.../BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h | 7 ++
.../Core/Inc/robot_state.h | 4 +
.../BHBF_Robot_Lifting_Lug/Core/Src/FSM.c | 72 ++++++++++++++-
.../BHBF_Robot_Lifting_Lug/Core/Src/main.c | 8 +-
.../Core/Src/robot_state.c | 10 +++
.../Paint_(1)/.settings/language.settings.xml | 4 +-
.../.settings/stm32cubeide.project.prefs | 6 +-
.../.settings/language.settings.xml | 4 +-
.../.settings/stm32cubeide.project.prefs | 6 +-
12 files changed, 219 insertions(+), 14 deletions(-)
create mode 100644 diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_Strong_grinding_machine.h
create mode 100644 diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml b/diaoerqiege/BHBF_Robot_Lifting_Lug/.settings/language.settings.xml
index e5e306c..3f35568 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/Core/BASE/Inc/MSP/msp_Strong_grinding_machine.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_Strong_grinding_machine.h
new file mode 100644
index 0000000..e1ac9fa
--- /dev/null
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Inc/MSP/msp_Strong_grinding_machine.h
@@ -0,0 +1,20 @@
+/*
+ * msp_Strong_grinding_machine.h
+ *
+ * Created on: 2026年3月27日
+ * Author: 13752
+ */
+
+#ifndef BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_
+#define BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_
+
+#include "bsp_UART.h"
+#include "BHBF_ROBOT.h"
+#include "msp_zhr29_200_laser_sensor.pb.h"
+#include "bsp_MB_host.h"
+
+extern uint8_t strong_grinding_machine_cmd;
+
+extern void strong_grinding_machine_intialize(struct UARTHandler *Handler);
+
+#endif /* BASE_INC_MSP_MSP_STRONG_GRINDING_MACHINE_H_ */
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c
new file mode 100644
index 0000000..1bd9ca6
--- /dev/null
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_Strong_grinding_machine.c
@@ -0,0 +1,88 @@
+/*
+ * msp_Strong_grinding_machine.c
+ *
+ * Created on: 2026年3月27日
+ * Author: 13752
+ */
+
+
+#include "msp_Strong_grinding_machine.h"
+
+static struct UARTHandler *Strong_grinding_machine_handler;
+static DispacherController *Strong_grinding_machine_dispacherController;
+
+static void Strong_grinding_machine_cmd(void);
+//static void decode_Strong_grinding_machine(uint8_t *buffer, uint16_t length);
+
+static const uint8_t inquiry_interval = 50;
+
+void strong_grinding_machine_intialize(struct UARTHandler *Handler)
+{
+ Strong_grinding_machine_handler = Handler;
+
+ Strong_grinding_machine_handler->Wait_time = 10;
+
+ Strong_grinding_machine_dispacherController = Handler->dispacherController;
+ Strong_grinding_machine_dispacherController->Dispacher_Enable = 1;
+ Strong_grinding_machine_dispacherController->DispacherCallTime = 100;
+ Strong_grinding_machine_dispacherController->Add_Dispatcher_List(Strong_grinding_machine_dispacherController,
+ Strong_grinding_machine_cmd);
+}
+
+// 测试,转速20rpm
+const uint8_t strong_grinding_machine_set_speed_cmd[8] = {0x01, 0x06, 0x00, 0x02, 0x00, 0x14, 0x28, 0x05};
+const uint8_t strong_grinding_machine_start_cmd[8] = {0x01, 0x06, 0x00, 0x01, 0x08, 0x82, 0x5F, 0xAB};
+const uint8_t strong_grinding_machine_stop_cmd[8] = {0x01, 0x06, 0x00, 0x01, 0x08, 0x81, 0x1F, 0xAA};
+
+static uint8_t strong_grinding_machine_cmd_flag = 0;
+uint8_t strong_grinding_machine_cmd = 0;
+const uint16_t strong_grinding_machine_speed = 20;
+
+void Strong_grinding_machine_cmd(void)
+{
+ switch(strong_grinding_machine_cmd_flag)
+ {
+ case 0:
+
+ MB_WriteHoldingReg(&Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
+ 0x01, 0x0002, strong_grinding_machine_speed);
+// Strong_grinding_machine_handler->TxCount = 8;
+// memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_set_speed_cmd, Strong_grinding_machine_handler->TxCount);
+ Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
+ inquiry_interval, NULL);
+ strong_grinding_machine_cmd_flag = 1;
+ break;
+ case 1:
+ if(strong_grinding_machine_cmd == 0)
+ {
+ Strong_grinding_machine_handler->TxCount = 8;
+ memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_stop_cmd, Strong_grinding_machine_handler->TxCount);
+ Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
+ inquiry_interval, NULL);
+ }
+ else if(strong_grinding_machine_cmd == 1)
+ {
+ Strong_grinding_machine_handler->TxCount = 8;
+ memcpy(&Strong_grinding_machine_handler->Tx_Buf, &strong_grinding_machine_start_cmd, Strong_grinding_machine_handler->TxCount);
+ Strong_grinding_machine_handler->AddSendList(Strong_grinding_machine_handler, Strong_grinding_machine_handler->Tx_Buf, Strong_grinding_machine_handler->TxCount,
+ inquiry_interval, NULL);
+ }
+ else{
+
+ }
+ strong_grinding_machine_cmd_flag = 0;
+ break;
+ }
+
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
index 88bcd89..236032f 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/FSM.h
@@ -26,6 +26,13 @@ typedef enum _Front_MoveSTATE_t
} Front_MoveSTATE_t;
+typedef enum _Strong_Grinding_Machine_MoveSTATE_t
+{
+ STRONG_GRINDING_MACHINE_HALT_STATE = 0,
+ STRONG_GRINDING_MACHINE_MOTION_STATE,
+
+} Strong_Grinding_Machine_MoveSTATE_t;
+
typedef struct _transition_t
{
int State; //状态
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h
index c1f7158..1eb7640 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Inc/robot_state.h
@@ -25,4 +25,8 @@ extern void Manual_Up_State_Do(void);
extern void Manual_Down_State_Do(void);
extern void FrontEnd_Halt_State_Do(void);
+// ********强磨机运动控制***********
+extern void Strong_Grinding_Machine_Halt_State_Do(void);
+extern void Strong_Grinding_Machine_Motion_State_Do(void);
+
#endif /* INC_ROBOT_STATE_H_ */
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
index 687a545..d0ffd51 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
@@ -12,6 +12,7 @@
#include "msp_TL720D.h"
#include "robot_state.h"
#include "bsp_TIMER.h"
+#include "msp_Strong_grinding_machine.h"
void action_perfrom(transition_t transitions[], int length, int state);
@@ -24,6 +25,8 @@ static void Frontend_Control();
MoveSTATE_t CurrentMoveState;
Front_MoveSTATE_t CurrentFrontEndState;
+Strong_Grinding_Machine_MoveSTATE_t StrongGrindingMachineCurrentState;
+
static int index_counter = 0;
@@ -34,7 +37,6 @@ transition_t MoveTransitions[] =
{ Move_HALT, HALT_State_Do },
};
-
transition_t FrontendMoveTransitions[] =
{
{ HALT_STATE, FrontEnd_Halt_State_Do},
@@ -43,6 +45,16 @@ transition_t FrontendMoveTransitions[] =
};
+transition_t StrongGrindingMachineTransitions[] =
+{
+ { STRONG_GRINDING_MACHINE_HALT_STATE, Strong_Grinding_Machine_Halt_State_Do},
+ { STRONG_GRINDING_MACHINE_MOTION_STATE, Strong_Grinding_Machine_Motion_State_Do},
+
+};
+
+
+
+
void Fsm_Init()
{
GF_BSP_Interrupt_Add_CallBack(
@@ -60,9 +72,67 @@ void GF_Dispatch()
// 前端控制
Frontend_Control();
+ //强磨机控制
+ Strong_Grinding_Machine_Control();
+
+
+
action_perfrom(MoveTransitions,sizeof(MoveTransitions) / sizeof(transition_t), CurrentMoveState);
action_perfrom(FrontendMoveTransitions,
sizeof(FrontendMoveTransitions) / sizeof(transition_t), CurrentFrontEndState);
+ action_perfrom(StrongGrindingMachineTransitions,
+ sizeof(StrongGrindingMachineTransitions) / sizeof(transition_t), StrongGrindingMachineCurrentState);
+}
+
+
+uint8_t IsAllowRotation = 0;
+void Strong_Grinding_Machine_Control()
+{
+ GF_BSP_GPIO_SetIO(4, 1);
+ IsAllowRotation = Knife_Detection();
+ if(IsAllowRotation == 1)
+ {
+ if(GV.MK32_Key.CH7_SD == -1000)
+ {
+ StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_MOTION_STATE;
+ }
+ else{
+ StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE;
+ }
+
+ }
+ else{
+ StrongGrindingMachineCurrentState = STRONG_GRINDING_MACHINE_HALT_STATE;
+ }
+
+}
+
+
+uint8_t loosening_knife_signal = 0;
+uint8_t clamping_knife_signal = 0;
+
+int Knife_Detection(void)
+{
+// uint8_t loosening_knife_signal = 1;
+// uint8_t clamping_knife_signal = 1;
+
+ // 夹刀信号检测
+ clamping_knife_signal = GF_BSP_GPIO_ReadIO(0);
+ // 松刀信号检测
+ loosening_knife_signal = GF_BSP_GPIO_ReadIO(1);
+
+ if(loosening_knife_signal == 0)
+ {
+ return 0;
+ }
+ else if(clamping_knife_signal == 0)
+ {
+ return 1;
+ }
+ else{
+ return 0;
+ }
+
}
void Frontend_Control()
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c
index 8f09a5e..c264eb7 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c
@@ -35,6 +35,7 @@
#include "motors.h"
#include "SliderControl.h"
#include "msp_zhr29_laser_sensor.h"
+#include "msp_Strong_grinding_machine.h"
/* USER CODE END Includes */
@@ -168,7 +169,6 @@ int main(void)
while (1)
{
-
//MX_LWIP_Process();
/* USER CODE END WHILE */
@@ -272,6 +272,9 @@ void CV_GV_Init()
P_MK32 = &GV.MK32_Key;
+ // 强磨机默认发送停止命令
+ strong_grinding_machine_cmd = 0;
+
// �?光测距传感器指针同步
g_zhr29_200_laser_sensor_1 = &GV.ZHR29_200_measure_results.laser_sensor_1_measure_distance;
g_zhr29_200_laser_sensor_2 = &GV.ZHR29_200_measure_results.laser_sensor_2_measure_distance;
@@ -340,6 +343,9 @@ void GF_Robot_Init()
// �?光测距传感器�?115200
zhr29_200_laser_sensor_intialize(&RS_485_3_UART_Handler);
+ // 强磨机
+ strong_grinding_machine_intialize(&RS_485_2_UART_Handler);
+
Fsm_Init();
uint8_t _state = 1;
diff --git a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c
index 1d20fdd..f86c9dd 100644
--- a/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c
+++ b/diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c
@@ -6,6 +6,7 @@
*/
#include "robot_state.h"
#include "bsp_GPIO.h"
+#include "msp_Strong_grinding_machine.h"
#define PI 3.1415926
@@ -259,6 +260,15 @@ void FrontEnd_Halt_State_Do(void)
GV.LS_FrontEnd_Motor.Target_Velcity = 0;
}
+void Strong_Grinding_Machine_Halt_State_Do(void)
+{
+ strong_grinding_machine_cmd = 0;
+}
+
+void Strong_Grinding_Machine_Motion_State_Do(void)
+{
+ strong_grinding_machine_cmd = 1;
+}
//void Manual_Up_Down_State_Do()
diff --git a/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/language.settings.xml b/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/language.settings.xml
index c4e0419..a0c1f28 100644
--- a/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/language.settings.xml
+++ b/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/stm32cubeide.project.prefs b/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/stm32cubeide.project.prefs
index c3eed36..c6876fe 100644
--- a/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/stm32cubeide.project.prefs
+++ b/guohuafengdian/Paint----6(1)/Paint_(1)/.settings/stm32cubeide.project.prefs
@@ -1,6 +1,6 @@
-2F62501ED4689FB349E356AB974DBE57=1E2381E617183AADF4456CCD6D53D61D
+2F62501ED4689FB349E356AB974DBE57=A84465D0AB7FC85C43037569F99B7E82
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612
66BE74F758C12D739921AEA421D593D3=0
-8DF89ED150041C4CBC7CB9A9CAA90856=1E2381E617183AADF4456CCD6D53D61D
-DC22A860405A8BF2F2C095E5B6529F12=BFAB4159B488818C3ED3C0C9D5058F5A
+8DF89ED150041C4CBC7CB9A9CAA90856=A84465D0AB7FC85C43037569F99B7E82
+DC22A860405A8BF2F2C095E5B6529F12=87EF6E86AD82C44D77A3A904E01D2A08
eclipse.preferences.version=1
diff --git a/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml b/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
index aa5b143..645d148 100644
--- a/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
+++ b/jueyuanzijiance/Insulator_Inspection/.settings/language.settings.xml
@@ -5,7 +5,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
diff --git a/jueyuanzijiance/Insulator_Inspection/.settings/stm32cubeide.project.prefs b/jueyuanzijiance/Insulator_Inspection/.settings/stm32cubeide.project.prefs
index 3aa0975..b373cf1 100644
--- a/jueyuanzijiance/Insulator_Inspection/.settings/stm32cubeide.project.prefs
+++ b/jueyuanzijiance/Insulator_Inspection/.settings/stm32cubeide.project.prefs
@@ -1,6 +1,6 @@
-2F62501ED4689FB349E356AB974DBE57=C1FAD6334016FA4DBFEEBFD567ADCF8D
+2F62501ED4689FB349E356AB974DBE57=072A9A3C3EA2FF5DA5BFC344F13F526F
635E684B79701B039C64EA45C3F84D30=0A24CDD2C9C910977CCC6D7CA9CB0612
66BE74F758C12D739921AEA421D593D3=0
-8DF89ED150041C4CBC7CB9A9CAA90856=C1FAD6334016FA4DBFEEBFD567ADCF8D
-DC22A860405A8BF2F2C095E5B6529F12=68A7121F69F6593E9817CACB2B0CB8AF
+8DF89ED150041C4CBC7CB9A9CAA90856=072A9A3C3EA2FF5DA5BFC344F13F526F
+DC22A860405A8BF2F2C095E5B6529F12=87EF6E86AD82C44D77A3A904E01D2A08
eclipse.preferences.version=1