正在考虑config该咋写
This commit is contained in:
parent
6fad9b04ea
commit
7fbec09276
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -2,6 +2,7 @@
|
|||||||
"C_Cpp.errorSquiggles": "disabled",
|
"C_Cpp.errorSquiggles": "disabled",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"pid.h": "c",
|
"pid.h": "c",
|
||||||
"main.h": "c"
|
"main.h": "c",
|
||||||
|
"motor_rm.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@ -26,9 +26,109 @@ Project File Date: 10/03/2025
|
|||||||
|
|
||||||
<h2>Output:</h2>
|
<h2>Output:</h2>
|
||||||
*** Using Compiler 'V6.16', folder: 'D:\cangming\ARM\ARMCLANG\Bin'
|
*** Using Compiler 'V6.16', folder: 'D:\cangming\ARM\ARMCLANG\Bin'
|
||||||
Build target 'shoot'
|
Rebuild target 'shoot'
|
||||||
Note: source file '..\User\bsp\can.c' - object file renamed from 'shoot\can.o' to 'shoot\can_1.o'.
|
Note: source file '..\User\bsp\can.c' - object file renamed from 'shoot\can.o' to 'shoot\can_1.o'.
|
||||||
"shoot\shoot.axf" - 0 Error(s), 0 Warning(s).
|
assembling startup_stm32f407xx.s...
|
||||||
|
compiling stm32f4xx_hal_flash_ramfunc.c...
|
||||||
|
compiling dma.c...
|
||||||
|
compiling stm32f4xx_hal_msp.c...
|
||||||
|
compiling stm32f4xx_it.c...
|
||||||
|
compiling usart.c...
|
||||||
|
compiling main.c...
|
||||||
|
compiling can.c...
|
||||||
|
compiling gpio.c...
|
||||||
|
compiling event_groups.c...
|
||||||
|
compiling freertos.c...
|
||||||
|
compiling stm32f4xx_hal_flash_ex.c...
|
||||||
|
compiling stm32f4xx_hal_gpio.c...
|
||||||
|
compiling stm32f4xx_hal_rcc.c...
|
||||||
|
compiling stm32f4xx_hal_cortex.c...
|
||||||
|
compiling stm32f4xx_hal_exti.c...
|
||||||
|
compiling stm32f4xx_hal_rcc_ex.c...
|
||||||
|
compiling stm32f4xx_hal_can.c...
|
||||||
|
compiling tasks.c...
|
||||||
|
compiling list.c...
|
||||||
|
compiling croutine.c...
|
||||||
|
compiling cmsis_os2.c...
|
||||||
|
compiling system_stm32f4xx.c...
|
||||||
|
compiling mm.c...
|
||||||
|
compiling stm32f4xx_hal.c...
|
||||||
|
compiling stm32f4xx_hal_pwr.c...
|
||||||
|
compiling stream_buffer.c...
|
||||||
|
compiling heap_4.c...
|
||||||
|
compiling port.c...
|
||||||
|
compiling stm32f4xx_hal_dma_ex.c...
|
||||||
|
compiling motor.c...
|
||||||
|
compiling stm32f4xx_hal_pwr_ex.c...
|
||||||
|
compiling stm32f4xx_hal_dma.c...
|
||||||
|
compiling time.c...
|
||||||
|
compiling dwt.c...
|
||||||
|
compiling timers.c...
|
||||||
|
compiling uart.c...
|
||||||
|
compiling stm32f4xx_hal_flash.c...
|
||||||
|
compiling queue.c...
|
||||||
|
compiling user_math.c...
|
||||||
|
../User/component/at9s_pro_cmd.c(2): warning: In file included from...
|
||||||
|
../User/component/at9s_pro_cmd.h(9): warning: In file included from...
|
||||||
|
../User\device/at9s_pro.h(17): warning: '__packed__' attribute ignored [-Wignored-attributes]
|
||||||
|
typedef __packed struct
|
||||||
|
^
|
||||||
|
../User\component/user_math.h(33): note: expanded from macro '__packed'
|
||||||
|
#define __packed __attribute__((__packed__))
|
||||||
|
^
|
||||||
|
1 warning generated.
|
||||||
|
compiling at9s_pro_cmd.c...
|
||||||
|
compiling vofa.c...
|
||||||
|
../User/device/AT9S_Pro.c(2): warning: In file included from...
|
||||||
|
../User/device/AT9S_Pro.h(17): warning: '__packed__' attribute ignored [-Wignored-attributes]
|
||||||
|
typedef __packed struct
|
||||||
|
^
|
||||||
|
../User\component/user_math.h(33): note: expanded from macro '__packed'
|
||||||
|
#define __packed __attribute__((__packed__))
|
||||||
|
^
|
||||||
|
1 warning generated.
|
||||||
|
compiling AT9S_Pro.c...
|
||||||
|
compiling can.c...
|
||||||
|
compiling motor_rm.c...
|
||||||
|
compiling filter.c...
|
||||||
|
compiling pid.c...
|
||||||
|
compiling stm32f4xx_hal_uart.c...
|
||||||
|
../User/task/init.c(10): warning: In file included from...
|
||||||
|
../User\component/at9s_pro_cmd.h(9): warning: In file included from...
|
||||||
|
../User\device/at9s_pro.h(17): warning: '__packed__' attribute ignored [-Wignored-attributes]
|
||||||
|
typedef __packed struct
|
||||||
|
^
|
||||||
|
../User\component/user_math.h(33): note: expanded from macro '__packed'
|
||||||
|
#define __packed __attribute__((__packed__))
|
||||||
|
^
|
||||||
|
1 warning generated.
|
||||||
|
compiling init.c...
|
||||||
|
../User/task/rc.c(8): warning: In file included from...
|
||||||
|
../User\device/at9s_pro.h(17): warning: '__packed__' attribute ignored [-Wignored-attributes]
|
||||||
|
typedef __packed struct
|
||||||
|
^
|
||||||
|
../User\component/user_math.h(33): note: expanded from macro '__packed'
|
||||||
|
#define __packed __attribute__((__packed__))
|
||||||
|
^
|
||||||
|
1 warning generated.
|
||||||
|
compiling rc.c...
|
||||||
|
compiling config.c...
|
||||||
|
compiling user_task.c...
|
||||||
|
../User/task/shoot_ctrl.c(10): warning: In file included from...
|
||||||
|
../User\component/at9s_pro_cmd.h(9): warning: In file included from...
|
||||||
|
../User\device/at9s_pro.h(17): warning: '__packed__' attribute ignored [-Wignored-attributes]
|
||||||
|
typedef __packed struct
|
||||||
|
^
|
||||||
|
../User\component/user_math.h(33): note: expanded from macro '__packed'
|
||||||
|
#define __packed __attribute__((__packed__))
|
||||||
|
^
|
||||||
|
1 warning generated.
|
||||||
|
compiling shoot_ctrl.c...
|
||||||
|
compiling shoot_control.c...
|
||||||
|
linking...
|
||||||
|
Program Size: Code=32128 RO-data=660 RW-data=268 ZI-data=23668
|
||||||
|
FromELF: creating hex file...
|
||||||
|
"shoot\shoot.axf" - 0 Error(s), 5 Warning(s).
|
||||||
|
|
||||||
<h2>Software Packages used:</h2>
|
<h2>Software Packages used:</h2>
|
||||||
|
|
||||||
@ -52,7 +152,7 @@ Package Vendor: Keil
|
|||||||
|
|
||||||
* Component: ARM::CMSIS:CORE:5.4.0
|
* Component: ARM::CMSIS:CORE:5.4.0
|
||||||
Include file: CMSIS\Core\Include\tz_context.h
|
Include file: CMSIS\Core\Include\tz_context.h
|
||||||
Build Time Elapsed: 00:00:00
|
Build Time Elapsed: 00:00:02
|
||||||
</pre>
|
</pre>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
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.
@ -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\stdbool.h)(0x6035A4A8)
|
||||||
I (D:\cangming\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
|
I (D:\cangming\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
|
||||||
F (..\User\component\pid.h)(0x68DFDF27)()
|
F (..\User\component\pid.h)(0x68DFDF27)()
|
||||||
F (..\User\module\shoot_control.c)(0x68E62342)(-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)
|
F (..\User\module\shoot_control.c)(0x68E654D6)(-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)(0x68E621FB)
|
I (..\User\module\shoot_control.h)(0x68E652F9)
|
||||||
I (..\Core\Inc\main.h)(0x68D1384A)
|
I (..\Core\Inc\main.h)(0x68D1384A)
|
||||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
||||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
||||||
@ -1367,9 +1367,9 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h)(0x68AD8208)
|
|||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.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 (D:\cangming\ARM\ARMCLANG\include\string.h)(0x6035A4A8)
|
||||||
I (..\User\bsp\time.h)(0x68DFDF27)
|
I (..\User\bsp\time.h)(0x68DFDF27)
|
||||||
F (..\User\module\shoot_control.h)(0x68E621FB)()
|
F (..\User\module\shoot_control.h)(0x68E652F9)()
|
||||||
F (..\User\module\config.c)(0x68E142A3)(-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\config.c)(0x68E652F9)(-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 (..\User\module\config.h)(0x68E63334)
|
||||||
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
||||||
I (..\User\component\pid.h)(0x68DFDF27)
|
I (..\User\component\pid.h)(0x68DFDF27)
|
||||||
I (..\User\component\filter.h)(0x68DFDF27)
|
I (..\User\component\filter.h)(0x68DFDF27)
|
||||||
@ -1424,8 +1424,8 @@ 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\task.h)(0x68AD8208)
|
||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.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 (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||||
I (..\User\module\shoot_control.h)(0x68E621FB)
|
I (..\User\module\shoot_control.h)(0x68E652F9)
|
||||||
F (..\User\module\config.h)(0x68DABE70)()
|
F (..\User\module\config.h)(0x68E63334)()
|
||||||
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)
|
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)
|
I (..\User\task\user_task.h)(0x68D3E4B9)
|
||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||||
@ -1468,7 +1468,7 @@ I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
|||||||
I (D:\cangming\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
I (D:\cangming\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||||
I (..\User\device\device.h)(0x68DFDFA7)
|
I (..\User\device\device.h)(0x68DFDFA7)
|
||||||
I (..\User\component\at9s_pro_cmd.h)(0x68D4B9F6)
|
I (..\User\component\at9s_pro_cmd.h)(0x68D4B9F6)
|
||||||
F (..\User\task\shoot_ctrl.c)(0x68DFE330)(-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)(0x68E63334)(-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 (..\User\task\user_task.h)(0x68D3E4B9)
|
||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||||
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
I (D:\cangming\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
||||||
@ -1489,7 +1489,7 @@ I (..\User\component\user_math.h)(0x68DFE123)
|
|||||||
I (D:\cangming\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
I (D:\cangming\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||||
I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
I (D:\cangming\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||||
I (..\User\device\device.h)(0x68DFDFA7)
|
I (..\User\device\device.h)(0x68DFDFA7)
|
||||||
I (..\User\module\shoot_control.h)(0x68E621FB)
|
I (..\User\module\shoot_control.h)(0x68E652F9)
|
||||||
I (..\Core\Inc\main.h)(0x68D1384A)
|
I (..\Core\Inc\main.h)(0x68D1384A)
|
||||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68AD823F)
|
||||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x68D1384A)
|
||||||
@ -1527,7 +1527,7 @@ I (..\Core\Inc\can.h)(0x68D13849)
|
|||||||
I (..\User\bsp\bsp.h)(0x68DFDF27)
|
I (..\User\bsp\bsp.h)(0x68DFDF27)
|
||||||
I (..\User\bsp\mm.h)(0x68DFDF27)
|
I (..\User\bsp\mm.h)(0x68DFDF27)
|
||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os.h)(0x68AD8208)
|
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os.h)(0x68AD8208)
|
||||||
I (..\User\module\config.h)(0x68DABE70)
|
I (..\User\module\config.h)(0x68E63334)
|
||||||
F (..\User\task\user_task.c)(0x68DCD9EF)(-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_task.o -MD)
|
F (..\User\task\user_task.c)(0x68DCD9EF)(-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_task.o -MD)
|
||||||
I (..\User\task\user_task.h)(0x68D3E4B9)
|
I (..\User\task\user_task.h)(0x68D3E4B9)
|
||||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68AD8208)
|
||||||
|
|||||||
@ -19,55 +19,14 @@ Config_RobotParam_t robot_config = {
|
|||||||
|
|
||||||
|
|
||||||
.shoot_param = {
|
.shoot_param = {
|
||||||
|
.fric_num=6,
|
||||||
.num_trig_tooth=8,
|
.num_trig_tooth=8,
|
||||||
.shot_freq=20.0f,
|
.shot_freq=20.0f,
|
||||||
.shot_burst_num=1,
|
.shot_burst_num=1,
|
||||||
|
.num_multilevel=1,
|
||||||
.jam_enable=true,
|
.jam_enable=true,
|
||||||
.jam_threshold=120.0f,
|
.jam_threshold=120.0f,
|
||||||
.jam_suspected_time=0.5f,
|
.jam_suspected_time=0.5f,
|
||||||
|
|
||||||
.fric_motor_param[0] = {
|
|
||||||
.can = BSP_CAN_2,
|
|
||||||
.id = 0x201,
|
|
||||||
.module = MOTOR_M3508,
|
|
||||||
.reverse = true,
|
|
||||||
.gear=false,
|
|
||||||
},
|
|
||||||
.fric_motor_param[1] = {
|
|
||||||
.can = BSP_CAN_2,
|
|
||||||
.id = 0x202,
|
|
||||||
.module = MOTOR_M3508,
|
|
||||||
.reverse = true,
|
|
||||||
.gear=false,
|
|
||||||
},
|
|
||||||
.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 = {
|
.trig_motor_param = {
|
||||||
.can = BSP_CAN_2,
|
.can = BSP_CAN_2,
|
||||||
.id = 0x207,
|
.id = 0x207,
|
||||||
@ -155,4 +114,37 @@ Config_RobotParam_t robot_config = {
|
|||||||
*/
|
*/
|
||||||
Config_RobotParam_t* Config_GetRobotParam(void) {
|
Config_RobotParam_t* Config_GetRobotParam(void) {
|
||||||
return &robot_config;
|
return &robot_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 初始化机器人配置参数
|
||||||
|
* @return 初始化结果
|
||||||
|
*/
|
||||||
|
int8_t Config_ShootInit(void) {
|
||||||
|
int fric_num = robot_config.shoot_param.fric_num;
|
||||||
|
int num_multilevel = robot_config.shoot_param.num_multilevel;
|
||||||
|
robot_config.shoot_param.fric_motor_param = (Shoot_MOTOR_RM_Param_t *)BSP_Malloc(fric_num * sizeof(Shoot_MOTOR_RM_Param_t));
|
||||||
|
if (robot_config.shoot_param.fric_motor_param == NULL) {
|
||||||
|
return -1; // 内存分配失败
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化摩擦轮参数
|
||||||
|
for (uint8_t i = 0; i < fric_num; i++) {
|
||||||
|
robot_config.shoot_param.fric_motor_param[i].param = (MOTOR_RM_Param_t){
|
||||||
|
.can = BSP_CAN_2,
|
||||||
|
.id = 0x201 + i,
|
||||||
|
.module = MOTOR_M3508,
|
||||||
|
.reverse = (i == 0||1) ? true : false,
|
||||||
|
.gear = false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if(num_multilevel==1){
|
||||||
|
robot_config.shoot_param.ratio_multilevel[0]=1.0f;
|
||||||
|
}
|
||||||
|
else if(num_multilevel>1){
|
||||||
|
robot_config.shoot_param.ratio_multilevel[0]=1.0f;
|
||||||
|
robot_config.shoot_param.ratio_multilevel[1]=1.1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SHOOT_OK;
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ typedef struct {
|
|||||||
* @return 机器人配置参数指针
|
* @return 机器人配置参数指针
|
||||||
*/
|
*/
|
||||||
Config_RobotParam_t* Config_GetRobotParam(void);
|
Config_RobotParam_t* Config_GetRobotParam(void);
|
||||||
|
int8_t Config_ShootInit(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -56,7 +56,8 @@ int8_t Shoot_ResetIntegral(Shoot_t *s)
|
|||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
uint8_t fric_num = s->param->fric_num;
|
||||||
|
for(int i=0;i<fric_num;i++)
|
||||||
{
|
{
|
||||||
PID_ResetIntegral(&s->pid.fric_follow[i]);
|
PID_ResetIntegral(&s->pid.fric_follow[i]);
|
||||||
PID_ResetIntegral(&s->pid.fric_err[i]);
|
PID_ResetIntegral(&s->pid.fric_err[i]);
|
||||||
@ -78,7 +79,8 @@ int8_t Shoot_ResetCalu(Shoot_t *s)
|
|||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
uint8_t fric_num = s->param->fric_num;
|
||||||
|
for(int i=0;i<fric_num;i++)
|
||||||
{
|
{
|
||||||
PID_Reset(&s->pid.fric_follow[i]);
|
PID_Reset(&s->pid.fric_follow[i]);
|
||||||
PID_Reset(&s->pid.fric_err[i]);
|
PID_Reset(&s->pid.fric_err[i]);
|
||||||
@ -104,7 +106,8 @@ int8_t Shoot_ResetOutput(Shoot_t *s)
|
|||||||
if (s == NULL) {
|
if (s == NULL) {
|
||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
uint8_t fric_num = s->param->fric_num;
|
||||||
|
for(int i=0;i<fric_num;i++)
|
||||||
{
|
{
|
||||||
s->output.out_follow[i]=0.0f;
|
s->output.out_follow[i]=0.0f;
|
||||||
s->output.out_err[i]=0.0f;
|
s->output.out_err[i]=0.0f;
|
||||||
@ -171,10 +174,11 @@ int8_t Chassis_UpdateFeedback(Shoot_t *s)
|
|||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
float rpm_sum=0.0f;
|
float rpm_sum=0.0f;
|
||||||
for(int i = 0; i < SHOOT_FRIC_NUM; i++) {
|
uint8_t fric_num = s->param->fric_num;
|
||||||
|
for(int i = 0; i < fric_num; i++) {
|
||||||
/* 更新摩擦轮电机反馈 */
|
/* 更新摩擦轮电机反馈 */
|
||||||
MOTOR_RM_Update(&s->param->fric_motor_param[i]);
|
MOTOR_RM_Update(&s->param->fric_motor_param[i].param);
|
||||||
MOTOR_RM_t *motor_fed = MOTOR_RM_GetMotor(&s->param->fric_motor_param[i]);
|
MOTOR_RM_t *motor_fed = MOTOR_RM_GetMotor(&s->param->fric_motor_param[i].param);
|
||||||
if(motor_fed!=NULL)
|
if(motor_fed!=NULL)
|
||||||
{
|
{
|
||||||
s->feedback.fric[i]=motor_fed->motor.feedback;
|
s->feedback.fric[i]=motor_fed->motor.feedback;
|
||||||
@ -188,7 +192,7 @@ int8_t Chassis_UpdateFeedback(Shoot_t *s)
|
|||||||
/* 计算平均摩擦轮电机转速反馈 */
|
/* 计算平均摩擦轮电机转速反馈 */
|
||||||
rpm_sum+=s->feedback.fric_rpm[i];
|
rpm_sum+=s->feedback.fric_rpm[i];
|
||||||
}
|
}
|
||||||
s->feedback.fric_avgrpm=rpm_sum/SHOOT_FRIC_NUM;
|
s->feedback.fric_avgrpm=rpm_sum/fric_num;
|
||||||
/* 更新拨弹电机反馈 */
|
/* 更新拨弹电机反馈 */
|
||||||
MOTOR_RM_Update(&s->param->trig_motor_param);
|
MOTOR_RM_Update(&s->param->trig_motor_param);
|
||||||
MOTOR_RM_t *motor_fed = MOTOR_RM_GetMotor(&s->param->trig_motor_param);
|
MOTOR_RM_t *motor_fed = MOTOR_RM_GetMotor(&s->param->trig_motor_param);
|
||||||
@ -218,10 +222,12 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
if (s == NULL || cmd == NULL) {
|
if (s == NULL || cmd == NULL) {
|
||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
|
uint8_t fric_num = s->param->fric_num;
|
||||||
|
uint8_t num_multilevel = s->param->num_multilevel;
|
||||||
if(!s->online /*|| s->mode==SHOOT_MODE_SAFE*/){
|
if(!s->online /*|| s->mode==SHOOT_MODE_SAFE*/){
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
for(int i=0;i<fric_num;i++)
|
||||||
{
|
{
|
||||||
MOTOR_RM_Relax(&s->param->fric_motor_param[i]);
|
MOTOR_RM_Relax(&s->param->fric_motor_param[i].param);
|
||||||
}
|
}
|
||||||
MOTOR_RM_Relax(&s->param->trig_motor_param);
|
MOTOR_RM_Relax(&s->param->trig_motor_param);
|
||||||
}
|
}
|
||||||
@ -231,13 +237,13 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
{
|
{
|
||||||
|
|
||||||
case SHOOT_STATE_IDLE:/*熄火等待*/
|
case SHOOT_STATE_IDLE:/*熄火等待*/
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
for(int i=0;i<fric_num;i++)
|
||||||
{ /* 转速归零 */
|
{ /* 转速归零 */
|
||||||
PID_ResetIntegral(&s->pid.fric_follow[i]);
|
PID_ResetIntegral(&s->pid.fric_follow[i]);
|
||||||
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],0.0f,s->feedback.fric_rpm[i],0,s->dt);
|
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],0.0f,s->feedback.fric_rpm[i],0,s->dt);
|
||||||
s->output.out_fric[i]=s->output.out_follow[i];
|
s->output.out_fric[i]=s->output.out_follow[i];
|
||||||
s->output.lpfout_fric[i] = LowPassFilter2p_Apply(&s->filter.fric.out[i], s->output.out_fric[i]);
|
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]);
|
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i].param, s->output.lpfout_fric[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig.rotor_abs_angle,0,s->dt);
|
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig.rotor_abs_angle,0,s->dt);
|
||||||
@ -256,18 +262,26 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOOT_STATE_READY:/*准备射击*/
|
case SHOOT_STATE_READY:/*准备射击*/
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
for(int i=fric_num;i<fric_num/i;i++)
|
||||||
{ /* 计算跟随输出、计算修正输出 */
|
{ /* 计算跟随输出、计算修正输出 */
|
||||||
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],s->target_variable.target_rpm/MAX_FRIC_RPM,s->feedback.fric_rpm[i],0,s->dt);
|
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],
|
||||||
s->output.out_err[i]=PID_Calc(&s->pid.fric_err[i],s->feedback.fric_avgrpm,s->feedback.fric_rpm[i],0,s->dt);
|
s->param->ratio_multilevel[i]*s->target_variable.target_rpm/MAX_FRIC_RPM,
|
||||||
/* 按比例缩放并加和输出 */
|
s->feedback.fric_rpm[i],
|
||||||
ScaleSumTo1(&s->output.out_follow[i], &s->output.out_err[i]);
|
0,
|
||||||
s->output.out_fric[i]=s->output.out_follow[i]+s->output.out_err[i];
|
s->dt);
|
||||||
/* 滤波 */
|
s->output.out_err[i]=PID_Calc(&s->pid.fric_err[i],
|
||||||
s->output.lpfout_fric[i] = LowPassFilter2p_Apply(&s->filter.fric.out[i], s->output.out_fric[i]);
|
s->feedback.fric_avgrpm,
|
||||||
/* 设置输出 */
|
s->feedback.fric_rpm[i],
|
||||||
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i], s->output.lpfout_fric[i]);
|
0,
|
||||||
}
|
s->dt);
|
||||||
|
/* 按比例缩放并加和输出 */
|
||||||
|
ScaleSumTo1(&s->output.out_follow[i], &s->output.out_err[i]);
|
||||||
|
s->output.out_fric[i]=s->output.out_follow[i]+s->output.out_err[i];
|
||||||
|
/* 滤波 */
|
||||||
|
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].param, s->output.lpfout_fric[i]);
|
||||||
|
}
|
||||||
/* 设置拨弹电机输出 */
|
/* 设置拨弹电机输出 */
|
||||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig.rotor_abs_angle,0,s->dt);
|
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig.rotor_abs_angle,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.outomg_trig =PID_Calc(&s->pid.trig_omg,s->output.outagl_trig,s->feedback.trig_rpm,0,s->dt);
|
||||||
@ -305,7 +319,7 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
|
|
||||||
case SHOOT_STATE_FIRE:/*射击*/
|
case SHOOT_STATE_FIRE:/*射击*/
|
||||||
Shoot_CaluTargetAngle(s, cmd);
|
Shoot_CaluTargetAngle(s, cmd);
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++)
|
for(int i=0;i<fric_num;i++)
|
||||||
{ /* 计算跟随输出、计算修正输出 */
|
{ /* 计算跟随输出、计算修正输出 */
|
||||||
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],s->target_variable.target_rpm/MAX_FRIC_RPM,s->feedback.fric_rpm[i],0,s->dt);
|
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],s->target_variable.target_rpm/MAX_FRIC_RPM,s->feedback.fric_rpm[i],0,s->dt);
|
||||||
s->output.out_err[i]=PID_Calc(&s->pid.fric_err[i],s->feedback.fric_avgrpm,s->feedback.fric_rpm[i],0,s->dt);
|
s->output.out_err[i]=PID_Calc(&s->pid.fric_err[i],s->feedback.fric_avgrpm,s->feedback.fric_rpm[i],0,s->dt);
|
||||||
@ -315,7 +329,7 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
/* 滤波 */
|
/* 滤波 */
|
||||||
s->output.lpfout_fric[i] = LowPassFilter2p_Apply(&s->filter.fric.out[i], s->output.out_fric[i]);
|
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]);
|
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i].param, s->output.lpfout_fric[i]);
|
||||||
}
|
}
|
||||||
/* 设置拨弹电机输出 */
|
/* 设置拨弹电机输出 */
|
||||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,s->target_variable.target_angle,s->feedback.trig.rotor_abs_angle,0,s->dt);
|
s->output.outagl_trig =PID_Calc(&s->pid.trig,s->target_variable.target_angle,s->feedback.trig.rotor_abs_angle,0,s->dt);
|
||||||
@ -337,9 +351,9 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* 输出 */
|
/* 输出 */
|
||||||
for(int i=SHOOT_FRIC_NUM-1;i>3;i-=4)
|
for(int i=fric_num-1;i>3;i-=4)
|
||||||
{
|
{
|
||||||
MOTOR_RM_Ctrl(&s->param->fric_motor_param[i]);
|
MOTOR_RM_Ctrl(&s->param->fric_motor_param[i].param);
|
||||||
}
|
}
|
||||||
MOTOR_RM_Ctrl(&s->param->trig_motor_param);
|
MOTOR_RM_Ctrl(&s->param->trig_motor_param);
|
||||||
last_firecmd = cmd->firecmd;
|
last_firecmd = cmd->firecmd;
|
||||||
@ -428,12 +442,34 @@ int8_t Shoot_Init(Shoot_t *s, Shoot_Params_t *param, float target_freq)
|
|||||||
if (s == NULL || param == NULL || target_freq <= 0.0f) {
|
if (s == NULL || param == NULL || target_freq <= 0.0f) {
|
||||||
return SHOOT_ERR_NULL; // 参数错误
|
return SHOOT_ERR_NULL; // 参数错误
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t fric_num = param->fric_num;
|
||||||
|
|
||||||
|
s->feedback.fric = (MOTOR_Feedback_t *) BSP_Malloc(fric_num * sizeof(MOTOR_Feedback_t));
|
||||||
|
s->feedback.fil_fric_rpm = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->feedback.fric_rpm = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->output.out_follow = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->output.out_err = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->output.out_fric = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->output.lpfout_fric = (float *) BSP_Malloc(fric_num * sizeof(float));
|
||||||
|
s->param->fric_motor_param= (Shoot_MOTOR_RM_Param_t *) BSP_Malloc(fric_num * sizeof(Shoot_MOTOR_RM_Param_t));
|
||||||
|
s->pid.fric_follow = (KPID_t *) BSP_Malloc(fric_num * sizeof(KPID_t));
|
||||||
|
s->pid.fric_err = (KPID_t *) BSP_Malloc(fric_num * sizeof(KPID_t));
|
||||||
|
s->filter.fric.in = (LowPassFilter2p_t *)BSP_Malloc(fric_num * sizeof(LowPassFilter2p_t));
|
||||||
|
s->filter.fric.out = (LowPassFilter2p_t *)BSP_Malloc(fric_num * sizeof(LowPassFilter2p_t));
|
||||||
|
|
||||||
|
if (s->feedback.fric == NULL || s->feedback.fil_fric_rpm == NULL || s->feedback.fric_rpm == NULL ||
|
||||||
|
s->output.out_follow == NULL || s->output.out_err == NULL || s->output.out_fric == NULL ||
|
||||||
|
s->output.lpfout_fric == NULL || s->param->fric_motor_param == NULL || s->pid.fric_follow == NULL ||
|
||||||
|
s->pid.fric_err == NULL || s->filter.fric.in == NULL || s->filter.fric.out == NULL) {
|
||||||
|
return SHOOT_ERR_MALLOC;}/* 内存分配失败 */
|
||||||
|
|
||||||
s->param=param;
|
s->param=param;
|
||||||
|
|
||||||
BSP_CAN_Init();
|
BSP_CAN_Init();
|
||||||
/* 初始化摩擦轮PID和滤波器 */
|
/* 初始化摩擦轮PID和滤波器 */
|
||||||
for(int i=0;i<SHOOT_FRIC_NUM;i++){
|
for(int i=0;i<fric_num;i++){
|
||||||
MOTOR_RM_Register(¶m->fric_motor_param[i]);
|
MOTOR_RM_Register(¶m->fric_motor_param[i].param);
|
||||||
PID_Init(&s->pid.fric_follow[i], KPID_MODE_CALC_D, target_freq,¶m->fric_follow);
|
PID_Init(&s->pid.fric_follow[i], KPID_MODE_CALC_D, target_freq,¶m->fric_follow);
|
||||||
PID_Init(&s->pid.fric_err[i], KPID_MODE_CALC_D, target_freq,¶m->fric_err);
|
PID_Init(&s->pid.fric_err[i], KPID_MODE_CALC_D, target_freq,¶m->fric_err);
|
||||||
LowPassFilter2p_Init(&s->filter.fric.in[i], target_freq, s->param->filter.fric.in);
|
LowPassFilter2p_Init(&s->filter.fric.in[i], target_freq, s->param->filter.fric.in);
|
||||||
|
|||||||
@ -18,8 +18,9 @@ extern "C" {
|
|||||||
#define SHOOT_OK (0) /* 运行正常 */
|
#define SHOOT_OK (0) /* 运行正常 */
|
||||||
#define SHOOT_ERR_NULL (-1) /* 运行时发现NULL指针 */
|
#define SHOOT_ERR_NULL (-1) /* 运行时发现NULL指针 */
|
||||||
#define SHOOT_ERR_ERR (-2) /* 运行时发现了其他错误 */
|
#define SHOOT_ERR_ERR (-2) /* 运行时发现了其他错误 */
|
||||||
#define SHOOT_ERR_MODE (-3) /* 运行时配置了错误的CMD_ChassisMode_t */
|
#define SHOOT_ERR_MODE (-3) /* 运行时配置了错误的Mode */
|
||||||
#define SHOOT_ERR_MOTOR (-4) /* 运行时配置了不存在的电机类型 */
|
#define SHOOT_ERR_MOTOR (-4) /* 运行时配置了不存在的电机类型 */
|
||||||
|
#define SHOOT_ERR_MALLOC (-5) /* 内存分配失败 */
|
||||||
|
|
||||||
#define SHOOT_FRIC_NUM (6) /* 摩擦轮数量 */
|
#define SHOOT_FRIC_NUM (6) /* 摩擦轮数量 */
|
||||||
#define MAX_FRIC_RPM 7000.0f
|
#define MAX_FRIC_RPM 7000.0f
|
||||||
@ -51,14 +52,20 @@ typedef struct {
|
|||||||
bool firecmd; /* 射击指令 */
|
bool firecmd; /* 射击指令 */
|
||||||
|
|
||||||
} Shoot_CMD_t;
|
} Shoot_CMD_t;
|
||||||
|
|
||||||
|
typedef struct{
|
||||||
|
MOTOR_RM_Param_t param;
|
||||||
|
uint8_t level; /*电机属于几级发射;1起始;num_multilevel大于1时有效,且不可大于num_multilevel*/
|
||||||
|
}Shoot_MOTOR_RM_Param_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
MOTOR_Feedback_t fric[SHOOT_FRIC_NUM]; /* 摩擦轮电机反馈 */
|
MOTOR_Feedback_t *fric; /* 摩擦轮电机反馈 */
|
||||||
MOTOR_Feedback_t trig; /* 拨弹电机反馈 */
|
MOTOR_Feedback_t trig; /* 拨弹电机反馈 */
|
||||||
|
|
||||||
float fil_fric_rpm[SHOOT_FRIC_NUM]; /* 滤波后的摩擦轮转速 */
|
float *fil_fric_rpm; /* 滤波后的摩擦轮转速 */
|
||||||
float fil_trig_rpm; /* 滤波后的拨弹电机转速*/
|
float fil_trig_rpm; /* 滤波后的拨弹电机转速*/
|
||||||
|
|
||||||
float fric_rpm[SHOOT_FRIC_NUM]; /* 归一化摩擦轮转速 */
|
float *fric_rpm; /* 归一化摩擦轮转速 */
|
||||||
float fric_avgrpm; /* 归一化摩擦轮平均转速*/
|
float fric_avgrpm; /* 归一化摩擦轮平均转速*/
|
||||||
float trig_rpm; /* 归一化拨弹电机转速*/
|
float trig_rpm; /* 归一化拨弹电机转速*/
|
||||||
|
|
||||||
@ -76,10 +83,10 @@ typedef struct {
|
|||||||
Shoot_JamDetectionFSM_State_t jamfsm_state; /* 卡弹检测状态 */
|
Shoot_JamDetectionFSM_State_t jamfsm_state; /* 卡弹检测状态 */
|
||||||
}Shoot_JamDetection_t;
|
}Shoot_JamDetection_t;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float out_follow[SHOOT_FRIC_NUM];
|
float *out_follow;
|
||||||
float out_err[SHOOT_FRIC_NUM];
|
float *out_err;
|
||||||
float out_fric[SHOOT_FRIC_NUM];
|
float *out_fric;
|
||||||
float lpfout_fric[SHOOT_FRIC_NUM];
|
float *lpfout_fric;
|
||||||
|
|
||||||
|
|
||||||
float outagl_trig;
|
float outagl_trig;
|
||||||
@ -90,18 +97,20 @@ typedef struct {
|
|||||||
|
|
||||||
/* 底盘参数的结构体,包含所有初始化用的参数,通常是const,存好几组 */
|
/* 底盘参数的结构体,包含所有初始化用的参数,通常是const,存好几组 */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
uint8_t fric_num; /* 摩擦轮数量 */
|
||||||
|
|
||||||
float num_trig_tooth; /* 拨弹盘每圈弹丸数量 */
|
float num_trig_tooth; /* 拨弹盘每圈弹丸数量 */
|
||||||
float shot_freq; /* 射击频率,单位Hz */
|
float shot_freq; /* 射击频率,单位Hz */
|
||||||
uint8_t shot_burst_num; /* 多发模式一次射击的数量 */
|
uint8_t shot_burst_num; /* 多发模式一次射击的数量 */
|
||||||
|
|
||||||
uint8_t num_multilevel; /* 多级发射级数 (默认每级摩擦轮的数量相等)*/
|
uint8_t num_multilevel; /* 多级发射级数 (默认每级摩擦轮的数量相等)*/
|
||||||
float multilevel_ratio[1]; /* 多级发射各级速度比例 */
|
float *ratio_multilevel; /* 多级发射各级速度比例 */
|
||||||
|
|
||||||
bool jam_enable; /* 是否启用卡弹检测 */ //还没加到逻辑里
|
bool jam_enable; /* 是否启用卡弹检测 */ //还没加到逻辑里
|
||||||
float jam_threshold; /* 卡弹检测阈值,单位A (dji2006建议设置为120A,dji3508建议设置为300A,根据实际测试调整)*/
|
float jam_threshold; /* 卡弹检测阈值,单位A (dji2006建议设置为120A,dji3508建议设置为300A,根据实际测试调整)*/
|
||||||
float jam_suspected_time; /* 卡弹怀疑时间,单位秒 */
|
float jam_suspected_time; /* 卡弹怀疑时间,单位秒 */
|
||||||
|
|
||||||
MOTOR_RM_Param_t fric_motor_param[SHOOT_FRIC_NUM];
|
Shoot_MOTOR_RM_Param_t *fric_motor_param;
|
||||||
MOTOR_RM_Param_t trig_motor_param;
|
MOTOR_RM_Param_t trig_motor_param;
|
||||||
|
|
||||||
|
|
||||||
@ -152,8 +161,8 @@ typedef struct {
|
|||||||
|
|
||||||
/* 反馈控制用的PID */
|
/* 反馈控制用的PID */
|
||||||
struct {
|
struct {
|
||||||
KPID_t fric_follow[SHOOT_FRIC_NUM]; /* 摩擦轮PID主结构体 */
|
KPID_t *fric_follow; /* 摩擦轮PID主结构体 */
|
||||||
KPID_t fric_err[SHOOT_FRIC_NUM]; /* 摩擦轮PID主结构体 */
|
KPID_t *fric_err; /* 摩擦轮PID主结构体 */
|
||||||
KPID_t trig; /* 拨弹PID主结构体 */
|
KPID_t trig; /* 拨弹PID主结构体 */
|
||||||
KPID_t trig_omg; /* 拨弹PID主结构体 */
|
KPID_t trig_omg; /* 拨弹PID主结构体 */
|
||||||
} pid;
|
} pid;
|
||||||
@ -161,8 +170,8 @@ typedef struct {
|
|||||||
/* 滤波器 */
|
/* 滤波器 */
|
||||||
struct {
|
struct {
|
||||||
struct{
|
struct{
|
||||||
LowPassFilter2p_t in[SHOOT_FRIC_NUM]; /* 反馈值滤波器 */
|
LowPassFilter2p_t *in; /* 反馈值滤波器 */
|
||||||
LowPassFilter2p_t out[SHOOT_FRIC_NUM]; /* 输出值滤波器 */
|
LowPassFilter2p_t *out; /* 输出值滤波器 */
|
||||||
}fric;
|
}fric;
|
||||||
struct{
|
struct{
|
||||||
LowPassFilter2p_t in; /* 反馈值滤波器 */
|
LowPassFilter2p_t in; /* 反馈值滤波器 */
|
||||||
|
|||||||
@ -36,6 +36,7 @@ void Task_shoot_ctrl(void *argument) {
|
|||||||
|
|
||||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||||
/* USER CODE INIT BEGIN */
|
/* USER CODE INIT BEGIN */
|
||||||
|
Config_ShootInit();
|
||||||
Shoot_Init(&shoot,&Config_GetRobotParam()->shoot_param,SHOOT_CTRL_FREQ);
|
Shoot_Init(&shoot,&Config_GetRobotParam()->shoot_param,SHOOT_CTRL_FREQ);
|
||||||
Shoot_SetMode(&shoot,SHOOT_MODE_BURST);
|
Shoot_SetMode(&shoot,SHOOT_MODE_BURST);
|
||||||
/* USER CODE INIT END */
|
/* USER CODE INIT END */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user