添加了卡弹检测,测试了六摩擦轮同时转但err环输出0
This commit is contained in:
parent
c38f98faac
commit
67d9a10647
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@ -22,16 +22,12 @@ Dialog DLL: TCM.DLL V1.48.0.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\CUBEMX\shoot\MDK-ARM\shoot.uvprojx
|
||||
Project File Date: 09/30/2025
|
||||
Project File Date: 10/02/2025
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V6.16', folder: 'D:\cangming\ARM\ARMCLANG\Bin'
|
||||
Build target 'shoot'
|
||||
Note: source file '..\User\bsp\can.c' - object file renamed from 'shoot\can.o' to 'shoot\can_1.o'.
|
||||
compiling shoot_control.c...
|
||||
linking...
|
||||
Program Size: Code=32304 RO-data=660 RW-data=196 ZI-data=22068
|
||||
FromELF: creating hex file...
|
||||
"shoot\shoot.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -1268,7 +1268,7 @@ I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h)(0x68AD823F)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h)(0x68AD823F)
|
||||
I (..\User\bsp\bsp.h)(0x68D3FFDB)
|
||||
F (..\User\device\AT9S_Pro.h)(0x68CE6AC0)()
|
||||
F (..\User\component\user_math.c)(0x68DD1413)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/user_math.o -MD)
|
||||
F (..\User\component\user_math.c)(0x68DE7D66)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/user_math.o -MD)
|
||||
I (..\User\component\user_math.h)(0x68D3FFDB)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
@ -1309,8 +1309,8 @@ I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
|
||||
F (..\User\component\pid.h)(0x68DD0ECB)()
|
||||
F (..\User\module\shoot_control.c)(0x68DD4CBD)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/shoot_control.o -MD)
|
||||
I (..\User\module\shoot_control.h)(0x68DD29DA)
|
||||
F (..\User\module\shoot_control.c)(0x68DE9081)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/shoot_control.o -MD)
|
||||
I (..\User\module\shoot_control.h)(0x68DE8F09)
|
||||
I (..\Core\Inc\main.h)(0x68D1384A)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
||||
@ -1367,8 +1367,8 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h)(0x68AD8208)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\string.h)(0x6035A4A8)
|
||||
I (..\User\bsp\time.h)(0x68D3FFDB)
|
||||
F (..\User\module\shoot_control.h)(0x68DD29DA)()
|
||||
F (..\User\module\config.c)(0x68DD4776)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/config.o -MD)
|
||||
F (..\User\module\shoot_control.h)(0x68DE8F09)()
|
||||
F (..\User\module\config.c)(0x68DE90D3)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/config.o -MD)
|
||||
I (..\User\module\config.h)(0x68DABE70)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
||||
I (..\User\component\pid.h)(0x68DD0ECB)
|
||||
@ -1424,7 +1424,7 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h)(0x68AD8208
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\task.h)(0x68AD8208)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h)(0x68AD8208)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||
I (..\User\module\shoot_control.h)(0x68DD29DA)
|
||||
I (..\User\module\shoot_control.h)(0x68DE8F09)
|
||||
F (..\User\module\config.h)(0x68DABE70)()
|
||||
F (..\User\task\init.c)(0x68D4AE2D)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/init.o -MD)
|
||||
I (..\User\task\user_task.h)(0x68D3E4B9)
|
||||
@ -1468,7 +1468,7 @@ I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (..\User\device\device.h)(0x68D400B4)
|
||||
I (..\User\component\at9s_pro_cmd.h)(0x68D4B9F6)
|
||||
F (..\User\task\shoot_ctrl.c)(0x68DC9C9B)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/shoot_ctrl.o -MD)
|
||||
F (..\User\task\shoot_ctrl.c)(0x68DE6A16)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -c
-fno-rtti -funsigned-char -fshort-enums -fshort-wchar
-gdwarf-3 -O1 -ffunction-sections -Wno-packed -Wno-missing-variable-declarations -Wno-missing-prototypes -Wno-missing-noreturn -Wno-sign-conversion -Wno-nonportable-include-path -Wno-reserved-id-macro -Wno-unused-macros -Wno-documentation-unknown-command -Wno-documentation -Wno-license-management -Wno-parentheses-equality -I ../Core/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc -I ../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I ../Drivers/CMSIS/Include -I ../Middlewares/Third_Party/FreeRTOS/Source/include -I ../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS_V2 -I ../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F -I ../User
-I./RTE/_shoot
-ID:/cangming/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/cangming/keil/STM32F4xx_DFP/2.15.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o shoot/shoot_ctrl.o -MD)
|
||||
I (..\User\task\user_task.h)(0x68D3E4B9)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
||||
@ -1489,7 +1489,7 @@ I (..\User\component\user_math.h)(0x68D3FFDB)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (..\User\device\device.h)(0x68D400B4)
|
||||
I (..\User\module\shoot_control.h)(0x68DD29DA)
|
||||
I (..\User\module\shoot_control.h)(0x68DE8F09)
|
||||
I (..\Core\Inc\main.h)(0x68D1384A)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
||||
|
||||
Binary file not shown.
@ -32,7 +32,6 @@ void OnProjectLoad (void) {
|
||||
//
|
||||
// User settings
|
||||
//
|
||||
Edit.SysVar (VAR_HSS_SPEED, "100 Hz");
|
||||
Project.SetOSPlugin ("FreeRTOSPlugin_Cortex-M");
|
||||
File.Open ("D:/CUBEMX/shoot/MDK-ARM/shoot/shoot.axf");
|
||||
Util.Error("==== 脚本已加载,路径请看标题栏", 0);
|
||||
|
||||
@ -4,23 +4,24 @@
|
||||
Breakpoint=D:/CUBEMX/shoot/User/device/motor_rm.c:145:32, State=BP_STATE_DISABLED
|
||||
Breakpoint=D:/CUBEMX/shoot/User/device/motor_rm.c:148:22, State=BP_STATE_DISABLED
|
||||
Breakpoint=D:/CUBEMX/shoot/User/module/shoot_control.c:114, State=BP_STATE_DISABLED
|
||||
GraphedExpression="((shoot).output).outomg_trig", Color=#e56a6f, Show=0
|
||||
GraphedExpression="((shoot).target_variable).target_angle", Color=#e56a6f
|
||||
GraphedExpression="((shoot).output).outagl_trig", Color=#35792b, Show=0
|
||||
GraphedExpression="((shoot).target_variable).target_angle", Color=#769dda
|
||||
GraphedExpression="((shoot).feedback).trig_angle_cicle", Color=#b14f0d
|
||||
GraphedExpression="((shoot).output).outomg_trig", Color=#769dda, Show=0
|
||||
GraphedExpression="((shoot).output).outlpf_trig", Color=#b14f0d, Show=0
|
||||
GraphedExpression="(((shoot).feedback).trig).torque_current", Color=#b3c38e, Show=0
|
||||
OpenDocument="motor.h", FilePath="D:/CUBEMX/shoot/User/device/motor.h", Line=0
|
||||
OpenDocument="tasks.c", FilePath="D:/CUBEMX/shoot/Middlewares/Third_Party/FreeRTOS/Source/tasks.c", Line=3652
|
||||
GraphedExpression="((shoot).feedback).trig_angle_cicle", Color=#ab7b05
|
||||
OpenDocument="tasks.c", FilePath="D:/CUBEMX/shoot/Middlewares/Third_Party/FreeRTOS/Source/tasks.c", Line=3617
|
||||
OpenDocument="startup_stm32f407xx.s", FilePath="D:/CUBEMX/shoot/MDK-ARM/startup_stm32f407xx.s", Line=161
|
||||
OpenDocument="main.c", FilePath="D:/CUBEMX/shoot/Core/Src/main.c", Line=66
|
||||
OpenDocument="stm32f4xx_hal_can.c", FilePath="D:/CUBEMX/shoot/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_can.c", Line=1558
|
||||
OpenDocument="shoot_control.h", FilePath="D:/CUBEMX/shoot/User/module/shoot_control.h", Line=42
|
||||
OpenDocument="shoot_control.h", FilePath="D:/CUBEMX/shoot/User/module/shoot_control.h", Line=111
|
||||
OpenDocument="config.c", FilePath="D:/CUBEMX/shoot/User/module/config.c", Line=39
|
||||
OpenDocument="queue.c", FilePath="D:/CUBEMX/shoot/Middlewares/Third_Party/FreeRTOS/Source/queue.c", Line=854
|
||||
OpenDocument="filter.c", FilePath="D:/CUBEMX/shoot/User/component/filter.c", Line=49
|
||||
OpenDocument="shoot_ctrl.c", FilePath="D:/CUBEMX/shoot/User/task/shoot_ctrl.c", Line=1
|
||||
OpenDocument="rc.c", FilePath="D:/CUBEMX/shoot/User/task/rc.c", Line=0
|
||||
OpenDocument="shoot_control.c", FilePath="D:/CUBEMX/shoot/User/module/shoot_control.c", Line=44
|
||||
OpenDocument="startup_stm32f407xx.s", FilePath="D:/CUBEMX/shoot/MDK-ARM/startup_stm32f407xx.s", Line=161
|
||||
OpenDocument="shoot_control.c", FilePath="D:/CUBEMX/shoot/User/module/shoot_control.c", Line=191
|
||||
OpenDocument="motor.h", FilePath="D:/CUBEMX/shoot/User/device/motor.h", Line=0
|
||||
OpenDocument="motor_rm.c", FilePath="D:/CUBEMX/shoot/User/device/motor_rm.c", Line=120
|
||||
OpenToolbar="Debug", Floating=0, x=0, y=0
|
||||
OpenWindow="Registers 1", DockArea=RIGHT, x=0, y=0, w=726, h=919, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, FilteredItems=[], RefreshRate=1
|
||||
@ -28,20 +29,20 @@ OpenWindow="Source Files", DockArea=LEFT, x=0, y=0, w=301, h=919, TabPos=0, TopO
|
||||
OpenWindow="Watched Data 1", DockArea=RIGHT, x=0, y=0, w=726, h=919, TabPos=0, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Functions", DockArea=LEFT, x=0, y=0, w=301, h=919, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
OpenWindow="Data Sampling", DockArea=BOTTOM, x=0, y=0, w=1007, h=536, TabPos=0, TopOfStack=1, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0, VisibleTab=0, UniformSampleSpacing=0
|
||||
OpenWindow="Timeline", DockArea=BOTTOM, x=1, y=0, w=1552, h=555, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="100 ms / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="927;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="1328;-69", CodeGraphLegendShown=0, CodeGraphLegendPosition="1344;0"
|
||||
OpenWindow="Timeline", DockArea=BOTTOM, x=1, y=0, w=1552, h=555, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=1, DataPaneShown=1, PowerPaneShown=0, CodePaneShown=0, PinCursor="Cursor Movable", TimePerDiv="200 ms / Div", TimeStampFormat="Time", DataGraphDrawAsPoints=0, DataGraphLegendShown=1, DataGraphUniformSampleSpacing=0, DataGraphLegendPosition="668;0", DataGraphShowNamesAtCursor=0, PowerGraphDrawAsPoints=0, PowerGraphLegendShown=0, PowerGraphAvgFilterTime=Off, PowerGraphAvgFilterLen=Off, PowerGraphUniformSampleSpacing=0, PowerGraphLegendPosition="1328;-69", CodeGraphLegendShown=0, CodeGraphLegendPosition="1344;0"
|
||||
OpenWindow="Console", DockArea=BOTTOM, x=0, y=0, w=1007, h=536, TabPos=1, TopOfStack=0, FilterBarShown=0, TotalValueBarShown=0, ToolBarShown=0
|
||||
SmartViewPlugin="", Page="", Toolbar="Hidden", Window="SmartView 1"
|
||||
TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[100;144;456]
|
||||
TableHeader="Watched Data 1", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Location";"Refresh"], ColWidths=[250;282;91;100]
|
||||
TableHeader="Registers 1", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Description"], ColWidths=[100;144;294]
|
||||
TableHeader="Functions", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Address";"Size";"#Insts";"Source"], ColWidths=[1594;104;100;100;286]
|
||||
TableHeader="Power Sampling", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";"Ch 0"], ColWidths=[100;100;100]
|
||||
TableHeader="Task List", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Name";"Run Count";"Priority";"Status";"Timeout";"Stack Info";"ID";"Mutex Count";"Notified Value";"Notify State"], ColWidths=[110;110;110;110;110;110;110;110;110;110]
|
||||
TableHeader="RegisterSelectionDialog", SortCol="None", SortOrder="ASCENDING", VisibleCols=[], ColWidths=[]
|
||||
TableHeader="Source Files", SortCol="File", SortOrder="ASCENDING", VisibleCols=["File";"Status";"Size";"#Insts";"Path"], ColWidths=[215;100;100;100;734]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" ((shoot).output).outomg_trig";" ((shoot).output).outagl_trig";" ((shoot).target_variable).target_angle";" ((shoot).feedback).trig_angle_cicle";" (((shoot).feedback).trig).torque_current"], ColWidths=[100;100;100;100;100;100;100]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[118;100;134;134;124;144;110;126;126]
|
||||
TableHeader="Watched Data 1", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Value";"Location";"Refresh"], ColWidths=[250;282;91;103]
|
||||
TableHeader="Data Sampling Table", SortCol="None", SortOrder="ASCENDING", VisibleCols=["Index";"Time";" ((shoot).target_variable).target_angle";" ((shoot).output).outagl_trig";" ((shoot).output).outomg_trig";" ((shoot).output).outlpf_trig";" (((shoot).feedback).trig).torque_current";" ((shoot).feedback).trig_angle_cicle"], ColWidths=[100;100;100;100;100;100;100;307]
|
||||
TableHeader="Data Sampling Setup", SortCol="Expression", SortOrder="ASCENDING", VisibleCols=["Expression";"Type";"Value";"Min";"Max";"Average";"# Changes";"Min. Change";"Max. Change"], ColWidths=[118;100;144;134;144;144;110;154;144]
|
||||
TableHeader="TargetExceptionDialog", SortCol="Name", SortOrder="ASCENDING", VisibleCols=["Name";"Value";"Address";"Description"], ColWidths=[200;100;100;340]
|
||||
WatchedExpression="shoot_ctrl_cmd_rc", RefreshRate=5, Window=Watched Data 1
|
||||
WatchedExpression="shoot_cmd", RefreshRate=5, Window=Watched Data 1
|
||||
WatchedExpression="shoot", RefreshRate=5, Window=Watched Data 1
|
||||
WatchedExpression="a", Window=Watched Data 1
|
||||
WatchedExpression="pos", RefreshRate=5, Window=Watched Data 1
|
||||
@ -48,11 +48,11 @@ inline float Sign(float in) { return (in > 0) ? 1.0f : 0.0f; }
|
||||
inline void ResetMoveVector(MoveVector_t *mv) { memset(mv, 0, sizeof(*mv)); }
|
||||
|
||||
/**
|
||||
* \brief 计算循环值的误差,用于没有负数值,并在一定范围内变化的值
|
||||
* 例如编码器:相差1.5PI其实等于相差-0.5PI
|
||||
* \brief 计算循环值的误差,适用于设定值与反馈值均在(x,y)范围内循环的情况,range应设定为y-x
|
||||
*例如:(-M_PI,M_PI)range=M_2PI;(0,M_2PI)range=M_2PI;(a,a+b)range=b;
|
||||
*
|
||||
* \param sp 被操作的值
|
||||
* \param fb 变化量
|
||||
* \param sp 设定值
|
||||
* \param fb 反馈值
|
||||
* \param range 被操作的值变化范围,正数时起效
|
||||
*
|
||||
* \return 函数运行结果
|
||||
@ -70,9 +70,12 @@ inline float CircleError(float sp, float fb, float range) {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief 循环加法,用于没有负数值,并在一定范围内变化的值
|
||||
* 例如编码器,在0-2PI内变化,1.5PI + 1.5PI = 1PI
|
||||
* \brief 循环加法,适用于被操作的值在(x,y)范围内循环的情况,range应设定为y-x
|
||||
* 例如:(-M_PI,M_PI)range=M_2PI;(0,M_2PI)range=M_2PI;(a,a+b)range=b;
|
||||
*
|
||||
* \param origin 被操作的值
|
||||
* \param delta 变化量
|
||||
|
||||
@ -22,12 +22,13 @@ Config_RobotParam_t robot_config = {
|
||||
.trig_step_angle=M_2PI/8,
|
||||
.shot_delay_time=0.2f,
|
||||
.shot_burst_num=4,
|
||||
|
||||
.jam_threshold=120.0f,
|
||||
.jam_suspected_time=0.5f,
|
||||
.fric_motor_param[0] = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x201,
|
||||
.module = MOTOR_M3508,
|
||||
.reverse = false,
|
||||
.reverse = true,
|
||||
.gear=false,
|
||||
},
|
||||
.fric_motor_param[1] = {
|
||||
@ -37,9 +38,37 @@ Config_RobotParam_t robot_config = {
|
||||
.reverse = true,
|
||||
.gear=false,
|
||||
},
|
||||
.trig_motor_param = {
|
||||
.fric_motor_param[2] = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x203,
|
||||
.module = MOTOR_M3508,
|
||||
.reverse = true,
|
||||
.gear=false,
|
||||
},
|
||||
.fric_motor_param[3] = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x204,
|
||||
.module = MOTOR_M3508,
|
||||
.reverse = true,
|
||||
.gear=false,
|
||||
},
|
||||
.fric_motor_param[4] = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x205,
|
||||
.module = MOTOR_M3508,
|
||||
.reverse = false,
|
||||
.gear=false,
|
||||
},
|
||||
.fric_motor_param[5] = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x206,
|
||||
.module = MOTOR_M3508,
|
||||
.reverse = false,
|
||||
.gear=false,
|
||||
},
|
||||
.trig_motor_param = {
|
||||
.can = BSP_CAN_1,
|
||||
.id = 0x203,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
.gear=true,
|
||||
@ -65,12 +94,12 @@ Config_RobotParam_t robot_config = {
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig = {
|
||||
.k=1.0f,
|
||||
.k=2.0f,
|
||||
.p=1.0f,
|
||||
.i=0.1f,
|
||||
.d=0.05f,
|
||||
.d=0.04f,
|
||||
.i_limit=0.8f,
|
||||
.out_limit=0.5f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=M_2PI,
|
||||
},
|
||||
@ -80,7 +109,7 @@ Config_RobotParam_t robot_config = {
|
||||
.i=0.3f,
|
||||
.d=0.5f,
|
||||
.i_limit=0.2f,
|
||||
.out_limit=0.9f,
|
||||
.out_limit=0.8f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
|
||||
@ -19,7 +19,7 @@ static inline void ScaleSumTo1(float *a, float *b) {
|
||||
}
|
||||
|
||||
|
||||
int8_t Shoot_SetMode(shoot_t *s, Shoot_Mode_t mode)
|
||||
int8_t Shoot_SetMode(Shoot_t *s, Shoot_Mode_t mode)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -28,7 +28,7 @@ int8_t Shoot_SetMode(shoot_t *s, Shoot_Mode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_ResetIntegral(shoot_t *s)
|
||||
int8_t Shoot_ResetIntegral(Shoot_t *s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -43,7 +43,7 @@ int8_t Shoot_ResetIntegral(shoot_t *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_ResetCalu(shoot_t *s)
|
||||
int8_t Shoot_ResetCalu(Shoot_t *s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -62,7 +62,7 @@ int8_t Shoot_ResetCalu(shoot_t *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_ResetOutput(shoot_t *s)
|
||||
int8_t Shoot_ResetOutput(Shoot_t *s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -80,7 +80,7 @@ int8_t Shoot_ResetOutput(shoot_t *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_CaluTargetRPM(shoot_t *s, float target_speed)
|
||||
int8_t Shoot_CaluTargetRPM(Shoot_t *s, float target_speed)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -94,23 +94,23 @@ int8_t Shoot_CaluTargetRPM(shoot_t *s, float target_speed)
|
||||
* \param s 包含发射数据的结构体
|
||||
* \param num 需要发射的弹丸数量
|
||||
*/
|
||||
int8_t Shoot_CaluTargetAngle(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
int8_t Shoot_CaluTargetAngle(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
{
|
||||
if (s == NULL || s->shoot_Anglecalu.num_to_shoot == 0) {
|
||||
if (s == NULL || s->anglecalu.num_to_shoot == 0) {
|
||||
return -1;
|
||||
}
|
||||
if(s->now - s->shoot_Anglecalu.time_last_shoot >= s->param->shot_delay_time && cmd->firecmd)
|
||||
if(s->now - s->anglecalu.time_last_shoot >= s->param->shot_delay_time && cmd->firecmd)
|
||||
{
|
||||
s->shoot_Anglecalu.time_last_shoot=s->now;
|
||||
s->anglecalu.time_last_shoot=s->now;
|
||||
s->target_variable.target_angle += s->param->trig_step_angle;
|
||||
if(s->target_variable.target_angle>M_PI)s->target_variable.target_angle-=M_2PI;
|
||||
else if((s->target_variable.target_angle<-M_PI))s->target_variable.target_angle+=M_2PI;
|
||||
s->shoot_Anglecalu.num_to_shoot--;
|
||||
s->anglecalu.num_to_shoot--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_Init(shoot_t *s, Shoot_Params_t *param, float target_freq)
|
||||
int8_t Shoot_Init(Shoot_t *s, Shoot_Params_t *param, float target_freq)
|
||||
{
|
||||
if (s == NULL || param == NULL || target_freq <= 0.0f) {
|
||||
return -1; // 参数错误
|
||||
@ -131,13 +131,13 @@ int8_t Shoot_Init(shoot_t *s, Shoot_Params_t *param, float target_freq)
|
||||
LowPassFilter2p_Init(&s->filter.trig.in, target_freq, s->param->filter.trig.in);
|
||||
LowPassFilter2p_Init(&s->filter.trig.out, target_freq, s->param->filter.trig.out);
|
||||
|
||||
memset(&s->shoot_Anglecalu,0,sizeof(s->shoot_Anglecalu));
|
||||
memset(&s->anglecalu,0,sizeof(s->anglecalu));
|
||||
memset(&s->output,0,sizeof(s->output));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Chassis_UpdateFeedback(shoot_t *s)
|
||||
int8_t Chassis_UpdateFeedback(Shoot_t *s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
@ -186,15 +186,11 @@ int8_t Chassis_UpdateFeedback(shoot_t *s)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
{
|
||||
if (s == NULL || cmd == NULL) {
|
||||
return -1; // 参数错误
|
||||
}
|
||||
s->now = BSP_TIME_Get_us() / 1000000.0f;
|
||||
s->dt = (BSP_TIME_Get_us() - s->lask_wakeup) / 1000000.0f;
|
||||
s->lask_wakeup = BSP_TIME_Get_us();
|
||||
s->online = cmd->online;
|
||||
if(!s->online /*|| s->mode==SHOOT_MODE_SAFE*/){
|
||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
||||
{
|
||||
@ -203,8 +199,10 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
MOTOR_RM_Relax(&s->param->trig_motor_param);
|
||||
}
|
||||
else{
|
||||
static float pos;
|
||||
switch(s->running_state)
|
||||
{
|
||||
|
||||
case SHOOT_STATE_IDLE:/*熄火等待*/
|
||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
||||
{
|
||||
@ -214,7 +212,8 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
s->output.lpfout_fric[i] = LowPassFilter2p_Apply(&s->filter.fric.out[i], s->output.out_fric[i]);
|
||||
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i], s->output.lpfout_fric[i]);
|
||||
}
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,s->target_variable.target_angle,s->feedback.trig_angle_cicle,0,s->dt);
|
||||
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig_angle_cicle,0,s->dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,s->output.outagl_trig,s->feedback.trig_rpm,0,s->dt);
|
||||
s->output.outlpf_trig =LowPassFilter2p_Apply(&s->filter.trig.out, s->output.outomg_trig);
|
||||
MOTOR_RM_SetOutput(&s->param->trig_motor_param, s->output.outlpf_trig);
|
||||
@ -241,7 +240,7 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i], s->output.lpfout_fric[i]);
|
||||
}
|
||||
/* 拨弹电机输出 */
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,s->target_variable.target_angle,s->feedback.trig_angle_cicle,0,s->dt);
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig_angle_cicle,0,s->dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,s->output.outagl_trig,s->feedback.trig_rpm,0,s->dt);
|
||||
s->output.outlpf_trig =LowPassFilter2p_Apply(&s->filter.trig.out, s->output.outomg_trig);
|
||||
MOTOR_RM_SetOutput(&s->param->trig_motor_param, s->output.outlpf_trig);
|
||||
@ -255,10 +254,8 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
}
|
||||
else if(last_firecmd==false&&cmd->firecmd==true)
|
||||
{
|
||||
Shoot_ResetCalu(s);
|
||||
Shoot_ResetOutput(s);
|
||||
s->running_state=SHOOT_STATE_FIRE;
|
||||
s->shoot_Anglecalu.num_to_shoot+=s->param->shot_burst_num;
|
||||
s->anglecalu.num_to_shoot+=s->param->shot_burst_num;
|
||||
|
||||
}
|
||||
break;
|
||||
@ -279,9 +276,8 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
MOTOR_RM_SetOutput(&s->param->trig_motor_param, s->output.outlpf_trig);
|
||||
if(!cmd->firecmd)
|
||||
{
|
||||
Shoot_ResetCalu(s);
|
||||
Shoot_ResetOutput(s);
|
||||
s->running_state=SHOOT_STATE_READY;
|
||||
pos=s->feedback.trig_angle_cicle;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -290,11 +286,76 @@ int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd)
|
||||
}
|
||||
}
|
||||
MOTOR_RM_Ctrl(&s->param->fric_motor_param[0]);
|
||||
MOTOR_RM_Ctrl(&s->param->fric_motor_param[4]);
|
||||
last_firecmd = cmd->firecmd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int8_t Shoot_JamDetectionFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return -1; // 参数错误
|
||||
}
|
||||
|
||||
switch (s->jamdetection.jamfsm_state) {
|
||||
case SHOOT_JAMFSM_STATE_NORMAL:
|
||||
if (s->feedback.trig.torque_current/1000.0f > s->param->jam_threshold) {
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_SUSPECTED;
|
||||
s->jamdetection.jam_last_time = s->now; // 记录怀疑开始时间
|
||||
}
|
||||
Shoot_RunningFSM(s, cmd); // 正常运行状态下继续执行射击状态机
|
||||
break;
|
||||
|
||||
case SHOOT_JAMFSM_STATE_SUSPECTED:
|
||||
if (s->feedback.trig.torque_current/1000.0f < s->param->jam_threshold) {
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
break;
|
||||
} else {
|
||||
if ((s->now - s->jamdetection.jam_last_time) >= s->param->jam_suspected_time) {
|
||||
s->jamdetection.jam_detected =true;
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_CONFIRMED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
break;
|
||||
|
||||
case SHOOT_JAMFSM_STATE_CONFIRMED:
|
||||
// 进入处理状态,修改拨弹盘目标角度
|
||||
s->target_variable.target_angle = s->feedback.trig_angle_cicle-0.5f*s->param->trig_step_angle;
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_DEAL;
|
||||
s->jamdetection.jam_last_time = s->now; // 记录处理开始时间
|
||||
case SHOOT_JAMFSM_STATE_DEAL:
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
if ((s->now - s->jamdetection.jam_last_time)>=0.3f&&s->output.outlpf_trig < 0.1f) { /* 给予0.3秒响应时间并检测输出,认为堵塞已解除 */
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Shoot_Control(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
{
|
||||
if (s == NULL || cmd == NULL) {
|
||||
return -1; // 参数错误
|
||||
}
|
||||
s->now = BSP_TIME_Get_us() / 1000000.0f;
|
||||
s->dt = (BSP_TIME_Get_us() - s->lask_wakeup) / 1000000.0f;
|
||||
s->lask_wakeup = BSP_TIME_Get_us();
|
||||
s->online = cmd->online;//改成检测电机是否在线
|
||||
//电机在线检测函数
|
||||
Shoot_JamDetectionFSM(s, cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -21,17 +21,22 @@ extern "C" {
|
||||
#define SHOOT_ERR_MODE (-3) /* 运行时配置了错误的CMD_ChassisMode_t */
|
||||
#define SHOOT_ERR_TYPE (-4) /* 运行时配置了错误的Chassis_Type_t */
|
||||
|
||||
#define SHOOT_FRIC_NUM (2) /* 摩擦轮数量 */
|
||||
#define SHOOT_FRIC_NUM (6) /* 摩擦轮数量 */
|
||||
#define MAX_FRIC_RPM 7000.0f
|
||||
#define MAX_TRIG_RPM 5000.0f
|
||||
/* Exported macro ----------------------------------------------------------- */
|
||||
/* Exported types ----------------------------------------------------------- */
|
||||
|
||||
typedef enum {
|
||||
SHOOT_JAMFSM_STATE_NORMAL = 0, // 常规状态
|
||||
SHOOT_JAMFSM_STATE_SUSPECTED, // 怀疑状态
|
||||
SHOOT_JAMFSM_STATE_CONFIRMED, // 确认状态
|
||||
SHOOT_JAMFSM_STATE_DEAL // 处理状态
|
||||
} Shoot_JamDetectionFSM_State_t;
|
||||
typedef enum {
|
||||
SHOOT_STATE_IDLE = 0, // 熄火
|
||||
SHOOT_STATE_READY, // 准备射击
|
||||
SHOOT_STATE_FIRE // 射击
|
||||
} Shoot_State_t;
|
||||
} Shoot_Running_State_t;
|
||||
|
||||
typedef enum {
|
||||
SHOOT_MODE_SAFE = 0, // 安全模式
|
||||
@ -67,6 +72,11 @@ typedef struct{
|
||||
uint8_t num_shooted;
|
||||
}Shoot_AngleCalu_t;
|
||||
|
||||
typedef struct {
|
||||
bool jam_detected; /* 卡弹检测结果 */
|
||||
float jam_last_time;/* 用于记录怀疑状态或处理状态的开始时间 */
|
||||
Shoot_JamDetectionFSM_State_t jamfsm_state; /* 卡弹检测状态机 */
|
||||
}Shoot_JamDetection_t;
|
||||
typedef struct {
|
||||
float out_follow[SHOOT_FRIC_NUM];
|
||||
float out_err[SHOOT_FRIC_NUM];
|
||||
@ -86,6 +96,9 @@ typedef struct {
|
||||
float shot_delay_time; /* 射击间隔时间,单位秒 */
|
||||
uint8_t shot_burst_num; /* 多发模式下一次射击的发数 */
|
||||
|
||||
float jam_threshold; /* 卡弹检测阈值,单位A */
|
||||
float jam_suspected_time; /* 卡弹怀疑时间,单位秒 */
|
||||
|
||||
MOTOR_RM_Param_t fric_motor_param[SHOOT_FRIC_NUM];
|
||||
MOTOR_RM_Param_t trig_motor_param;
|
||||
|
||||
@ -119,14 +132,15 @@ typedef struct {
|
||||
uint64_t lask_wakeup;
|
||||
float dt;
|
||||
|
||||
Shoot_Params_t *param; /* */
|
||||
Shoot_Params_t *param; /* 发射参数 */
|
||||
/* 模块通用 */
|
||||
Shoot_State_t running_state; /* 运行状态机 */
|
||||
Shoot_Running_State_t running_state; /* 运行状态机 */
|
||||
Shoot_Mode_t mode;
|
||||
/* 反馈信息 */
|
||||
Shoot_Feedback_t feedback;
|
||||
/* 控制信息*/
|
||||
Shoot_AngleCalu_t shoot_Anglecalu;
|
||||
Shoot_JamDetection_t jamdetection;
|
||||
Shoot_AngleCalu_t anglecalu;
|
||||
Shoot_Output_t output;
|
||||
/* 目标控制量 */
|
||||
struct {
|
||||
@ -156,7 +170,7 @@ typedef struct {
|
||||
|
||||
float errtosee; /*调试用*/
|
||||
|
||||
} shoot_t;
|
||||
} Shoot_t;
|
||||
|
||||
/* Exported functions prototypes -------------------------------------------- */
|
||||
|
||||
@ -169,7 +183,7 @@ typedef struct {
|
||||
*
|
||||
* \return 函数运行结果
|
||||
*/
|
||||
int8_t Shoot_Init(shoot_t *s, Shoot_Params_t *param, float target_freq);
|
||||
int8_t Shoot_Init(Shoot_t *s, Shoot_Params_t *param, float target_freq);
|
||||
|
||||
/**
|
||||
* \brief 更新反馈
|
||||
@ -178,7 +192,7 @@ int8_t Shoot_Init(shoot_t *s, Shoot_Params_t *param, float target_freq);
|
||||
*
|
||||
* \return 函数运行结果
|
||||
*/
|
||||
int8_t Chassis_UpdateFeedback(shoot_t *s);
|
||||
int8_t Chassis_UpdateFeedback(Shoot_t *s);
|
||||
|
||||
/**
|
||||
* \brief 初始化发射
|
||||
@ -188,7 +202,7 @@ int8_t Chassis_UpdateFeedback(shoot_t *s);
|
||||
*
|
||||
* \return 函数运行结果
|
||||
*/
|
||||
int8_t Shoot_Control(shoot_t *s, Shoot_CMD_t *cmd);
|
||||
int8_t Shoot_Control(Shoot_t *s, Shoot_CMD_t *cmd);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
/* Private macro ------------------------------------------------------------ */
|
||||
/* Private variables -------------------------------------------------------- */
|
||||
COMP_AT9S_CMD_t shoot_ctrl_cmd_rc;
|
||||
shoot_t shoot;
|
||||
Shoot_t shoot;
|
||||
Shoot_CMD_t shoot_cmd;
|
||||
/* USER STRUCT BEGIN */
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user