发射测试
This commit is contained in:
parent
217132301d
commit
dbf0aee315
File diff suppressed because one or more lines are too long
@ -120,7 +120,7 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"Any" -UAny -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
||||
<Name>-X"Any" -UAny -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -32,9 +32,6 @@ Note: source file '..\User\bsp\gpio.c' - object file renamed from 'gimbal\gpio.o
|
||||
Note: source file '..\User\bsp\i2c.c' - object file renamed from 'gimbal\i2c.o' to 'gimbal\i2c_1.o'.
|
||||
Note: source file '..\User\bsp\spi.c' - object file renamed from 'gimbal\spi.o' to 'gimbal\spi_1.o'.
|
||||
Note: source file '..\User\task\ai.c' - object file renamed from 'gimbal\ai.o' to 'gimbal\ai_1.o'.
|
||||
compiling config.c...
|
||||
linking...
|
||||
Program Size: Code=100768 RO-data=1728 RW-data=680 ZI-data=35968
|
||||
"gimbal\gimbal.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
@ -59,7 +56,7 @@ Package Vendor: Keil
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.4.0
|
||||
Include file: CMSIS\Core\Include\tz_context.h
|
||||
Build Time Elapsed: 00:00:02
|
||||
Build Time Elapsed: 00:00:01
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2156,7 +2156,7 @@ I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h)(0x68B05645)
|
||||
I (..\User\component\calc_lib.h)(0x693AB321)
|
||||
F (..\User\device\ai.c)(0x6957CB15)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/ai.o -MD)
|
||||
F (..\User\device\ai.c)(0x695895DC)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/ai.o -MD)
|
||||
I (..\User\device\ai.h)(0x6941B613)
|
||||
I (..\User\component\user_math.h)(0x6943F21A)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
@ -2352,7 +2352,7 @@ I (..\User\module\struct_typedef.h)(0x693AB322)
|
||||
I (..\User\component\bsp_rc.h)(0x693AB321)
|
||||
I (..\User\device\ai.h)(0x6941B613)
|
||||
I (..\User\module\remote_cmd.h)(0x6957FAC3)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
F (..\User\task\atti_esti.c)(0x6957E358)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/atti_esti.o -MD)
|
||||
I (..\User\task\user_task.h)(0x6957F1E7)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68B055DB)
|
||||
@ -2489,7 +2489,7 @@ I (..\User\bsp\bsp.h)(0x6943F21A)
|
||||
I (..\User\bsp\mm.h)(0x6943F21A)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os.h)(0x68B055DB)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
F (..\User\task\user_task.c)(0x6957E357)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/user_task.o -MD)
|
||||
I (..\User\task\user_task.h)(0x6957F1E7)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68B055DB)
|
||||
@ -2572,8 +2572,8 @@ I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\module\config.h)(0x693FC3A8)
|
||||
I (..\User\device\motor_lz.h)(0x6943F21A)
|
||||
I (..\User\device\motor_lk.h)(0x6943F21A)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
F (..\User\task\shoot_ctrl.c)(0x6957FD8A)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/shoot_ctrl.o -MD)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
F (..\User\task\shoot_ctrl.c)(0x69589103)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/shoot_ctrl.o -MD)
|
||||
I (..\User\task\user_task.h)(0x6957F1E7)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68B055DB)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
|
||||
@ -2587,7 +2587,7 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\portable\RVDS\ARM_CM4F\portmacro.h
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h)(0x68B055DB)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\task.h)(0x68B055DB)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h)(0x68B055DB)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
I (..\Core\Inc\main.h)(0x693FEFE9)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68B05645)
|
||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x693FEFE9)
|
||||
@ -2621,12 +2621,12 @@ I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h)(0x68B05645)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (..\User\component\pid.h)(0x6943F21A)
|
||||
I (..\User\component\filter.h)(0x6943F21A)
|
||||
I (..\User\component\user_math.h)(0x6943F21A)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\device\motor.h)(0x6943F21A)
|
||||
I (..\User\device\device.h)(0x6943F21A)
|
||||
@ -2710,7 +2710,7 @@ I (..\User\bsp\bsp.h)(0x6943F21A)
|
||||
I (..\User\bsp\mm.h)(0x6943F21A)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os.h)(0x68B055DB)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
F (..\User\module\config.c)(0x69580122)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/config.o -MD)
|
||||
F (..\User\module\config.c)(0x695898BA)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/config.o -MD)
|
||||
I (..\User\component\user_math.h)(0x6943F21A)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
@ -2776,10 +2776,12 @@ I (..\User\component\filter.h)(0x6943F21A)
|
||||
I (..\User\component\pid.h)(0x6943F21A)
|
||||
I (..\User\device\motor_dm.h)(0x6943F21A)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
F (..\User\module\shoot.c)(0x68EE49C5)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/shoot.o -MD)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
F (..\User\module\shoot.c)(0x695895DC)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/shoot.o -MD)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\string.h)(0x6035A4A8)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
|
||||
I (..\Core\Inc\main.h)(0x693FEFE9)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h)(0x68B05645)
|
||||
I (..\Core\Inc\stm32f4xx_hal_conf.h)(0x693FEFE9)
|
||||
@ -2795,7 +2797,6 @@ I (..\Drivers\CMSIS\Include\cmsis_armclang.h)(0x68B05646)
|
||||
I (..\Drivers\CMSIS\Include\mpu_armv7.h)(0x68B05646)
|
||||
I (..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h)(0x68B05646)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h)(0x68B05645)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h)(0x68B05645)
|
||||
@ -2815,12 +2816,11 @@ I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h)(0x68B05645)
|
||||
I (..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h)(0x68B05645)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (..\User\component\pid.h)(0x6943F21A)
|
||||
I (..\User\component\filter.h)(0x6943F21A)
|
||||
I (..\User\component\user_math.h)(0x6943F21A)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\device\motor.h)(0x6943F21A)
|
||||
I (..\User\device\device.h)(0x6943F21A)
|
||||
@ -2904,7 +2904,7 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h)(0x68B055DB)
|
||||
I (..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h)(0x68B055DB)
|
||||
I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\bsp\time.h)(0x6943F21A)
|
||||
F (..\User\module\remote_cmd.c)(0x6957FD5C)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/remote_cmd.o -MD)
|
||||
F (..\User\module\remote_cmd.c)(0x69589322)(-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 -O0 -ffunction-sections -w -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 ../User/bsp -I ../User/component -I ../User/device -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/task -I ../User -I ../User/module
-I./RTE/_gimbal
-ID:/Keil_v5/Arm/Packs/ARM/CMSIS/5.7.0/CMSIS/Core/Include
-ID:/Keil_v5/Arm/Packs/Keil/STM32F4xx_DFP/2.17.1/Drivers/CMSIS/Device/ST/STM32F4xx/Include
-D__UVISION_VERSION="534" -D_RTE_ -DSTM32F407xx -D_RTE_ -DUSE_HAL_DRIVER -DSTM32F407xx
-o gimbal/remote_cmd.o -MD)
|
||||
I (..\User\module\remote_cmd.h)(0x6957FAC3)
|
||||
I (..\User\component\user_math.h)(0x6943F21A)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
|
||||
@ -2971,7 +2971,7 @@ I (..\User\device\motor_rm.h)(0x6943F21A)
|
||||
I (..\User\device\remote_control.h)(0x6957E45B)
|
||||
I (..\User\module\struct_typedef.h)(0x693AB322)
|
||||
I (..\User\component\bsp_rc.h)(0x693AB321)
|
||||
I (..\User\module\shoot.h)(0x68EE6FF5)
|
||||
I (..\User\module\shoot.h)(0x69588E9B)
|
||||
I (D:\Keil_v5\ARM\ARMCLANG\include\string.h)(0x6035A4A8)
|
||||
I (..\User\bsp\uart.h)(0x6943F21A)
|
||||
I (..\Core\Inc\usart.h)(0x6940024F)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,8 @@
|
||||
gimbal/shoot.o: ..\User\module\shoot.c \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\math.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\string.h ..\User\module\shoot.h \
|
||||
..\Core\Inc\main.h ..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stddef.h ..\Core\Inc\main.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h \
|
||||
..\Core\Inc\stm32f4xx_hal_conf.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h \
|
||||
@ -14,7 +16,6 @@ gimbal/shoot.o: ..\User\module\shoot.c \
|
||||
..\Drivers\CMSIS\Include\mpu_armv7.h \
|
||||
..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stddef.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h \
|
||||
@ -34,11 +35,10 @@ gimbal/shoot.o: ..\User\module\shoot.c \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h \
|
||||
..\User\component\pid.h ..\User\component\filter.h \
|
||||
..\User\component\user_math.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\float.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\math.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h \
|
||||
..\User\device\motor_rm.h ..\User\device\motor.h \
|
||||
..\User\device\device.h ..\User\device\motor.h ..\User\bsp\can.h \
|
||||
..\Core\Inc\can.h ..\Core\Inc\main.h ..\User\bsp\bsp.h \
|
||||
|
||||
Binary file not shown.
@ -44,11 +44,11 @@ gimbal/shoot_ctrl.o: ..\User\task\shoot_ctrl.c ..\User\task\user_task.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h \
|
||||
..\User\component\pid.h ..\User\component\filter.h \
|
||||
..\User\component\user_math.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\float.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\math.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h \
|
||||
..\User\device\motor_rm.h ..\User\device\motor.h \
|
||||
..\User\device\device.h ..\User\device\motor.h ..\User\bsp\can.h \
|
||||
..\Core\Inc\can.h ..\Core\Inc\main.h ..\User\bsp\bsp.h \
|
||||
|
||||
Binary file not shown.
@ -55,7 +55,7 @@ int8_t AI_ParseHost(AI_t* ai,Gimbal_Feedback_t* g_feedback){
|
||||
ai->TX.q[3]=g_feedback->imu.quat.q3;
|
||||
|
||||
ai->TX.bullet_count=10;
|
||||
ai->TX.bullet_speed=10;
|
||||
ai->TX.bullet_speed=22;
|
||||
|
||||
ai->TX.crc16=CRC16_Calc(((const uint8_t*)&(ai->TX)),sizeof(ai->TX)-sizeof(uint16_t), CRC16_INIT );
|
||||
if(CRC16_Verify(((const uint8_t*)&(ai->TX)), sizeof(ai->TX))!=true){
|
||||
|
||||
@ -175,116 +175,128 @@ Config_RobotParam_t robot_config = {
|
||||
},
|
||||
|
||||
.shoot_param = {
|
||||
.proj=SHOOT_PROJECTILE_17MM,
|
||||
.fric_num=4,
|
||||
.extra_deceleration_ratio=1.0f,
|
||||
.num_trig_tooth=2,
|
||||
.shot_freq=20.0f,
|
||||
.shot_burst_num=10,
|
||||
.num_multilevel=1,
|
||||
.jam_enable=false,
|
||||
.jam_threshold=120.0f,
|
||||
.jam_suspected_time=0.5f,
|
||||
.trig_motor_param = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x207,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = true,
|
||||
.gear=true,
|
||||
.basic={
|
||||
.projectileType=SHOOT_PROJECTILE_17MM,
|
||||
.fric_num=2,
|
||||
.extra_deceleration_ratio=1.0f,
|
||||
.num_trig_tooth=8,
|
||||
.shot_freq=20.0f,
|
||||
.shot_burst_num=5,
|
||||
.ratio_multilevel = {1.0f},
|
||||
},
|
||||
.jamDetection={
|
||||
.enable=true,
|
||||
.threshold=105.0f,
|
||||
.suspectedTime=1.0f,
|
||||
},
|
||||
// .fric_motor_param = (Shoot_MOTOR_RM_Param_t[]){
|
||||
// {
|
||||
// .param = {
|
||||
// .can = BSP_CAN_2,
|
||||
// .id = 0x201,
|
||||
// .module = MOTOR_M3508,
|
||||
// .reverse = false,
|
||||
// .gear=true,},
|
||||
// .level = 1},
|
||||
// {
|
||||
// .param = {
|
||||
// .can = BSP_CAN_2,
|
||||
// .id = 0x203,
|
||||
// .module = MOTOR_M3508,
|
||||
// .reverse = true,
|
||||
// .gear=true,},
|
||||
// .level = 1},
|
||||
//// {.param = {.can = BSP_CAN_1, .id = 0x203, .module = MOTOR_M3508}, .level = 2},
|
||||
// {.param = {.can = BSP_CAN_1, .id = 0x204, .module = MOTOR_M3508}, .level = 2},
|
||||
// },
|
||||
.fric_follow = {
|
||||
.k=1.0f,
|
||||
.p=1.8f,
|
||||
.i=0.0f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.0f,
|
||||
.out_limit=0.9f,
|
||||
.d_cutoff_freq=30.0f,
|
||||
.range=-1.0f,
|
||||
.motor={
|
||||
.fric = {
|
||||
{
|
||||
.param = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x201,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
.gear = false,
|
||||
},
|
||||
.level=1,
|
||||
},
|
||||
{
|
||||
.param = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x202,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = true,
|
||||
.gear = false,
|
||||
},
|
||||
.level=1,
|
||||
},
|
||||
|
||||
},
|
||||
.trig = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x203,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
.gear=true,
|
||||
},
|
||||
},
|
||||
.fric_err = {
|
||||
.k=0.0f,
|
||||
.p=4.0f,
|
||||
.i=0.4f,
|
||||
.d=0.04f,
|
||||
.i_limit=0.25f,
|
||||
.out_limit=0.25f,
|
||||
.d_cutoff_freq=40.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig_2006 = {
|
||||
.k=0.5f,
|
||||
.p=1.0f,
|
||||
.i=0.1f,
|
||||
.d=0.05f,
|
||||
.i_limit=0.8f,
|
||||
.out_limit=0.5f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=M_2PI,
|
||||
},
|
||||
.trig_omg_2006 = {
|
||||
.k=0.5f,
|
||||
.p=1.5f,
|
||||
.i=0.3f,
|
||||
.d=0.5f,
|
||||
.i_limit=0.2f,
|
||||
.out_limit=0.9f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig_3508 = {
|
||||
.k=0.5f,
|
||||
.p=1.8f,
|
||||
.i=0.3f,
|
||||
.d=0.1f,
|
||||
.i_limit=0.15f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=M_2PI,
|
||||
},
|
||||
.trig_omg_3508 = {
|
||||
.k=1.0f,
|
||||
.p=1.0f,
|
||||
.i=0.0f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.0f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.filter.fric = {
|
||||
.in = 30.0f,
|
||||
.out = 30.0f,
|
||||
},
|
||||
.filter.trig = {
|
||||
.in = 30.0f,
|
||||
.out = 30.0f,
|
||||
.pid={
|
||||
.fric_follow = {
|
||||
.k=1.0f,
|
||||
.p=1.5f,
|
||||
.i=0.3f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.2f,
|
||||
.out_limit=0.9f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.fric_err = {
|
||||
.k=0.0f,
|
||||
.p=4.0f,
|
||||
.i=0.4f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.25f,
|
||||
.out_limit=0.25f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig_2006 = {
|
||||
.k=1.0f,
|
||||
.p=1.0f,
|
||||
.i=0.1f,
|
||||
.d=0.04f,
|
||||
.i_limit=0.4f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=M_2PI,
|
||||
},
|
||||
.trig_omg_2006 = {
|
||||
.k=2.0f,
|
||||
.p=1.5f,
|
||||
.i=0.3f,
|
||||
.d=0.5f,
|
||||
.i_limit=0.2f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig_3508 = {
|
||||
.k=0.5f,
|
||||
.p=1.8f,
|
||||
.i=0.3f,
|
||||
.d=0.1f,
|
||||
.i_limit=0.15f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=M_2PI,
|
||||
},
|
||||
.trig_omg_3508 = {
|
||||
.k=1.0f,
|
||||
.p=1.0f,
|
||||
.i=0.0f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.0f,
|
||||
.out_limit=1.0f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
},
|
||||
.filter={
|
||||
.fric = {
|
||||
.in = 30.0f,
|
||||
.out = 30.0f,
|
||||
},
|
||||
.trig = {
|
||||
.in = 30.0f,
|
||||
.out = 30.0f,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief 获取机器人配置参数
|
||||
* @return 机器人配置参数指针
|
||||
@ -293,38 +305,3 @@ Config_RobotParam_t* Config_GetRobotParam(void) {
|
||||
return &robot_config;
|
||||
}
|
||||
|
||||
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) {
|
||||
BSP_Free(robot_config.shoot_param.fric_motor_param);
|
||||
return -1; // 内存分配失败
|
||||
}
|
||||
robot_config.shoot_param.ratio_multilevel = (float *)BSP_Malloc(num_multilevel * sizeof(float));
|
||||
if (robot_config.shoot_param.ratio_multilevel == NULL) {
|
||||
BSP_Free(robot_config.shoot_param.ratio_multilevel);
|
||||
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,
|
||||
/*设置电机反装;example***********************
|
||||
.reverse = (i == 0||1||3||5) ? true : false,*/
|
||||
|
||||
.reverse = (i == 1) ? true : false,
|
||||
.gear = false,
|
||||
};
|
||||
}
|
||||
/*规定电机属于哪级发射;example************************
|
||||
robot_config.shoot_param.fric_motor_param[0].level=1;*/
|
||||
robot_config.shoot_param.fric_motor_param[0].level=1;
|
||||
robot_config.shoot_param.fric_motor_param[1].level=1;
|
||||
/*规定各级摩擦轮转速比;example*********************
|
||||
robot_config.shoot_param.ratio_multilevel[0]=1.0f;*/
|
||||
robot_config.shoot_param.ratio_multilevel[0]=1.0f;
|
||||
return SHOOT_OK;
|
||||
}
|
||||
@ -9,13 +9,13 @@
|
||||
#include "shoot.h"
|
||||
int8_t remote_ParseHost(Gimbal_CMD_t *g_cmd,RC_ctrl_t *rc_ctrl,Gimbal_IMU_t*imu)
|
||||
{
|
||||
if(rc_ctrl->sw[1]==306){
|
||||
if(rc_ctrl->sw[5]==200){
|
||||
g_cmd->mode=GIMBAL_MODE_ABSOLUTE;
|
||||
// g_cmd->delta_pit=((rc_ctrl->ch[1]-114)*(0.1/758));//806~-780,0.473~-0.71
|
||||
// g_cmd->delta_yaw=((rc_ctrl->ch[0]+84)*(1.8/781));//400~-397
|
||||
|
||||
}
|
||||
else if(rc_ctrl->sw[1]==1694)
|
||||
else if(rc_ctrl->sw[5]==1800)
|
||||
{
|
||||
g_cmd->mode=GIMBAL_MODE_RELAX;
|
||||
}
|
||||
@ -24,43 +24,38 @@ int8_t remote_ParseHost(Gimbal_CMD_t *g_cmd,RC_ctrl_t *rc_ctrl,Gimbal_IMU_t*imu)
|
||||
|
||||
int8_t shoot_remote_cmd(Shoot_CMD_t *s_cmd,RC_ctrl_t *rc_ctrl,Remote_Mode *mode)
|
||||
{
|
||||
if(rc_ctrl!=NULL){
|
||||
s_cmd->online=true;
|
||||
s_cmd->mode=true;
|
||||
}
|
||||
// if(rc_ctrl!=NULL){
|
||||
// s_cmd->online=true;
|
||||
// }
|
||||
|
||||
if(rc_ctrl->sw[6]==1000){
|
||||
s_cmd->online=false;
|
||||
s_cmd->mode=false;
|
||||
}
|
||||
|
||||
|
||||
if(rc_ctrl->sw[3]==1800){
|
||||
if(rc_ctrl->sw[3]==1800){
|
||||
s_cmd->firecmd=false;
|
||||
s_cmd->ready=false;
|
||||
}
|
||||
if(rc_ctrl->sw[3]==1000)
|
||||
{
|
||||
|
||||
|
||||
if(rc_ctrl->sw[3]==1000){
|
||||
s_cmd->firecmd=false;
|
||||
s_cmd->ready=true;
|
||||
}
|
||||
if(rc_ctrl->sw[3]==200)
|
||||
if(rc_ctrl->sw[3]==200)
|
||||
{
|
||||
s_cmd->firecmd=true;
|
||||
s_cmd->ready=true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(rc_ctrl->sw[4]==200){
|
||||
if(rc_ctrl->sw[4]==1800){
|
||||
mode->S_Mode= SHOOT_MODE_SAFE ; /* 安全模式 */
|
||||
}
|
||||
if(rc_ctrl->sw[4]==1000)
|
||||
{
|
||||
mode->S_Mode= SHOOT_MODE_SINGLE ; /* 安全模式 */
|
||||
}
|
||||
if(rc_ctrl->sw[4]==1800)
|
||||
if(rc_ctrl->sw[4]==200)
|
||||
{
|
||||
mode->S_Mode= SHOOT_MODE_BURST ; /* 安全模式 */
|
||||
mode->S_Mode= SHOOT_MODE_CONTINUE ; /* 安全模式 */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ void Task(void *argument) {
|
||||
|
||||
Config_ShootInit();
|
||||
Shoot_Init(&shoot,&Config_GetRobotParam()->shoot_param,SHOOT_CTRL_FREQ);
|
||||
Shoot_SetMode(&shoot,SHOOT_MODE_SINGLE); 初始化一个模式
|
||||
Shoot_SetMode(&shoot,SHOOT_MODE_SINGLE); 关于模式选择:初始化一个模式
|
||||
|
||||
while (1) {
|
||||
|
||||
@ -21,7 +21,7 @@ void Task(void *argument) {
|
||||
shoot_cmd.ready =shoot_ctrl_cmd_rc.shoot.ready;
|
||||
shoot_cmd.firecmd =shoot_ctrl_cmd_rc.shoot.firecmd;
|
||||
|
||||
shoot.mode =shoot_ctrl_cmd_rc.mode; 或者用遥控器随时切换模式;二选一
|
||||
shoot.mode =shoot_ctrl_cmd_rc.mode; 关于模式选择:或者用遥控器随时切换模式,二选一
|
||||
|
||||
Chassis_UpdateFeedback(&shoot);
|
||||
Shoot_Control(&shoot,&shoot_cmd);
|
||||
@ -31,6 +31,7 @@ void Task(void *argument) {
|
||||
|
||||
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "shoot.h"
|
||||
#include "bsp/mm.h"
|
||||
@ -39,10 +40,12 @@ void Task(void *argument) {
|
||||
#include "component/user_math.h"
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
/* Private define ----------------------------------------------------------- */
|
||||
#define WONDERFUL_COMPENSATION_FORHERO 0.010478f//给英雄做的补偿
|
||||
#define MAX_FRIC_RPM 7000.0f
|
||||
#define MAX_TRIG_RPM 4000.0f//这里可能也会影响最高发射频率,待测试
|
||||
/* Private macro ------------------------------------------------------------ */
|
||||
/* Private variables -------------------------------------------------------- */
|
||||
static bool last_firecmd;
|
||||
|
||||
/* Private function -------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
@ -59,7 +62,6 @@ int8_t Shoot_SetMode(Shoot_t *s, Shoot_Mode_t mode)
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
s->mode=mode;
|
||||
s->anglecalu.num_to_shoot=0;
|
||||
return SHOOT_OK;
|
||||
}
|
||||
|
||||
@ -75,7 +77,7 @@ int8_t Shoot_ResetIntegral(Shoot_t *s)
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
uint8_t fric_num = s->param->fric_num;
|
||||
uint8_t fric_num = s->param->basic.fric_num;
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
PID_ResetIntegral(&s->pid.fric_follow[i]);
|
||||
@ -98,7 +100,7 @@ int8_t Shoot_ResetCalu(Shoot_t *s)
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
uint8_t fric_num = s->param->fric_num;
|
||||
uint8_t fric_num = s->param->basic.fric_num;
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
PID_Reset(&s->pid.fric_follow[i]);
|
||||
@ -125,7 +127,7 @@ int8_t Shoot_ResetOutput(Shoot_t *s)
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
uint8_t fric_num = s->param->fric_num;
|
||||
uint8_t fric_num = s->param->basic.fric_num;
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
s->output.out_follow[i]=0.0f;
|
||||
@ -138,6 +140,22 @@ int8_t Shoot_ResetOutput(Shoot_t *s)
|
||||
s->output.outlpf_trig=0.0f;
|
||||
return SHOOT_OK;
|
||||
}
|
||||
//float last_angle=0.0f;
|
||||
//float speed=0.0f;
|
||||
//int8_t Shoot_CalufeedbackRPM(Shoot_t *s)
|
||||
//{
|
||||
// if (s == NULL) {
|
||||
// return SHOOT_ERR_NULL; // 参数错误
|
||||
// }
|
||||
//// static
|
||||
// float err;
|
||||
// err=CircleError(s->feedback.fric[0].rotor_abs_angle,last_angle,M_2PI);
|
||||
// speed=err/s->dt/M_2PI*60.0f;
|
||||
// last_angle=s->feedback.fric->rotor_abs_angle;
|
||||
|
||||
|
||||
// return SHOOT_OK;
|
||||
//}
|
||||
|
||||
/**
|
||||
* \brief 根据目标弹丸速度计算摩擦轮目标转速
|
||||
@ -152,13 +170,13 @@ int8_t Shoot_CaluTargetRPM(Shoot_t *s, float target_speed)
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
switch(s->param->proj)
|
||||
switch(s->param->basic.projectileType)
|
||||
{
|
||||
case SHOOT_PROJECTILE_17MM:
|
||||
s->target_variable.target_rpm=5000.0f/MAX_FRIC_RPM;
|
||||
s->target_variable.fric_rpm=6350.0f;
|
||||
break;
|
||||
case SHOOT_PROJECTILE_42MM:
|
||||
s->target_variable.target_rpm=5000.0f/MAX_FRIC_RPM;
|
||||
s->target_variable.fric_rpm=4000.0f;
|
||||
break;
|
||||
}
|
||||
return SHOOT_OK;
|
||||
@ -174,23 +192,54 @@ int8_t Shoot_CaluTargetRPM(Shoot_t *s, float target_speed)
|
||||
*/
|
||||
int8_t Shoot_CaluTargetAngle(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
{
|
||||
if (s == NULL || s->anglecalu.num_to_shoot == 0) {
|
||||
if (s == NULL || s->var_trig.num_toShoot == 0) {
|
||||
return SHOOT_ERR_NULL;
|
||||
}
|
||||
float dt = s->now - s->anglecalu.time_last_shoot;
|
||||
float dt = s->timer.now - s->var_trig.time_lastShoot;
|
||||
float dpos;
|
||||
dpos = CircleError(s->target_variable.target_angle, s->feedback.trig_agl, M_2PI);
|
||||
if(dt >= 1.0f/s->param->shot_freq && cmd->firecmd && dpos<=1.0f)
|
||||
dpos = CircleError(s->target_variable.trig_angle, s->var_trig.trig_agl, M_2PI);
|
||||
if(dt >= 1.0f/s->param->basic.shot_freq && cmd->firecmd && dpos<=1.0f)
|
||||
{
|
||||
s->anglecalu.time_last_shoot=s->now;
|
||||
CircleAdd(&s->target_variable.target_angle, M_2PI/s->param->num_trig_tooth, M_2PI);
|
||||
if(s->param->trig_motor_param.module==MOTOR_M3508){
|
||||
s->target_variable.target_angle+=WONDERFUL_COMPENSATION_FORHERO;}
|
||||
s->anglecalu.num_to_shoot--;
|
||||
s->var_trig.time_lastShoot=s->timer.now;
|
||||
CircleAdd(&s->target_variable.trig_angle, M_2PI/s->param->basic.num_trig_tooth, M_2PI);
|
||||
s->var_trig.num_toShoot--;
|
||||
}
|
||||
return SHOOT_OK;
|
||||
}
|
||||
|
||||
static float Shoot_CaluCoupledWeight(Shoot_t *s, uint8_t fric_index)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
|
||||
float Threshold;
|
||||
switch (s->param->basic.projectileType) {
|
||||
case SHOOT_PROJECTILE_17MM:
|
||||
Threshold=50.0f;
|
||||
break;
|
||||
case SHOOT_PROJECTILE_42MM:
|
||||
Threshold=400.0f;
|
||||
break;
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float err;
|
||||
err=fabs((s->param->basic.ratio_multilevel[fric_index]
|
||||
*s->target_variable.fric_rpm)
|
||||
-s->feedback.fric[fric_index].rotor_speed);
|
||||
if (err<Threshold)
|
||||
{
|
||||
s->var_fric.coupled_control_weights=1.0f-(err*err)/(Threshold*Threshold);
|
||||
}
|
||||
else
|
||||
{
|
||||
s->var_fric.coupled_control_weights=0.0f;
|
||||
}
|
||||
return s->var_fric.coupled_control_weights;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief 更新射击模块的电机反馈信息
|
||||
*
|
||||
@ -198,44 +247,46 @@ int8_t Shoot_CaluTargetAngle(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
*
|
||||
* \return 函数运行结果
|
||||
*/
|
||||
int8_t Chassis_UpdateFeedback(Shoot_t *s)
|
||||
int8_t Shoot_UpdateFeedback(Shoot_t *s)
|
||||
{
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
float rpm_sum=0.0f;
|
||||
uint8_t fric_num = s->param->fric_num;
|
||||
uint8_t fric_num = s->param->basic.fric_num;
|
||||
for(int i = 0; i < fric_num; 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].param);
|
||||
MOTOR_RM_Update(&s->param->motor.fric[i].param);
|
||||
MOTOR_RM_t *motor_fed = MOTOR_RM_GetMotor(&s->param->motor.fric[i].param);
|
||||
if(motor_fed!=NULL)
|
||||
{
|
||||
s->feedback.fric[i]=motor_fed->motor.feedback;
|
||||
}
|
||||
/* 滤波摩擦轮电机转速反馈 */
|
||||
s->feedback.fil_fric_rpm[i] = LowPassFilter2p_Apply(&s->filter.fric.in[i], s->feedback.fric[i].rotor_speed);
|
||||
s->var_fric.fil_rpm[i] = LowPassFilter2p_Apply(&s->filter.fric.in[i], s->feedback.fric[i].rotor_speed);
|
||||
/* 归一化摩擦轮电机转速反馈 */
|
||||
s->feedback.fric_rpm[i] = s->feedback.fil_fric_rpm[i] / MAX_FRIC_RPM;
|
||||
if(s->feedback.fric_rpm[i]>1.0f)s->feedback.fric_rpm[i]=1.0f;
|
||||
if(s->feedback.fric_rpm[i]<-1.0f)s->feedback.fric_rpm[i]=-1.0f;
|
||||
s->var_fric.normalized_fil_rpm[i] = s->var_fric.fil_rpm[i] / MAX_FRIC_RPM;
|
||||
if(s->var_fric.normalized_fil_rpm[i]>1.0f)s->var_fric.normalized_fil_rpm[i]=1.0f;
|
||||
if(s->var_fric.normalized_fil_rpm[i]<-1.0f)s->var_fric.normalized_fil_rpm[i]=-1.0f;
|
||||
/* 计算平均摩擦轮电机转速反馈 */
|
||||
rpm_sum+=s->feedback.fric_rpm[i];
|
||||
s->var_fric.normalized_fil_avgrpm[s->param->motor.fric[i].level-1]+=s->var_fric.normalized_fil_rpm[i];
|
||||
}
|
||||
for (int i=1; i<MAX_NUM_MULTILEVEL; i++)
|
||||
{
|
||||
s->var_fric.normalized_fil_avgrpm[i]=s->var_fric.normalized_fil_avgrpm[i]/fric_num/MAX_NUM_MULTILEVEL;
|
||||
}
|
||||
s->feedback.fric_avgrpm=rpm_sum/fric_num;
|
||||
/* 更新拨弹电机反馈 */
|
||||
MOTOR_RM_Update(&s->param->trig_motor_param);
|
||||
s->feedback.trig = *MOTOR_RM_GetMotor(&s->param->trig_motor_param);
|
||||
s->feedback.trig_agl=s->param->extra_deceleration_ratio*s->feedback.trig.gearbox_total_angle;
|
||||
while(s->feedback.trig_agl<0)s->feedback.trig_agl+=M_2PI;
|
||||
while(s->feedback.trig_agl>=M_2PI)s->feedback.trig_agl-=M_2PI;
|
||||
MOTOR_RM_Update(&s->param->motor.trig);
|
||||
s->feedback.trig = *MOTOR_RM_GetMotor(&s->param->motor.trig);
|
||||
s->var_trig.trig_agl=s->param->basic.extra_deceleration_ratio*s->feedback.trig.gearbox_total_angle;
|
||||
while(s->var_trig.trig_agl<0)s->var_trig.trig_agl+=M_2PI;
|
||||
while(s->var_trig.trig_agl>=M_2PI)s->var_trig.trig_agl-=M_2PI;
|
||||
if (s->feedback.trig.motor.reverse) {
|
||||
s->feedback.trig_agl = M_2PI - s->feedback.trig_agl;
|
||||
s->var_trig.trig_agl = M_2PI - s->var_trig.trig_agl;
|
||||
}
|
||||
s->feedback.fil_trig_rpm = LowPassFilter2p_Apply(&s->filter.trig.in, s->feedback.trig.feedback.rotor_speed);
|
||||
s->feedback.trig_rpm = s->feedback.trig.feedback.rotor_speed / MAX_TRIG_RPM;
|
||||
if(s->feedback.trig_rpm>1.0f)s->feedback.trig_rpm=1.0f;
|
||||
if(s->feedback.trig_rpm<-1.0f)s->feedback.trig_rpm=-1.0f;
|
||||
s->var_trig.fil_trig_rpm = LowPassFilter2p_Apply(&s->filter.trig.in, s->feedback.trig.feedback.rotor_speed);
|
||||
s->var_trig.trig_rpm = s->feedback.trig.feedback.rotor_speed / MAX_TRIG_RPM;
|
||||
if(s->var_trig.trig_rpm>1.0f)s->var_trig.trig_rpm=1.0f;
|
||||
if(s->var_trig.trig_rpm<-1.0f)s->var_trig.trig_rpm=-1.0f;
|
||||
|
||||
s->errtosee = s->feedback.fric[0].rotor_speed - s->feedback.fric[1].rotor_speed;
|
||||
return SHOOT_OK;
|
||||
@ -254,34 +305,33 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
if (s == NULL || cmd == 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*/){
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
MOTOR_RM_Relax(&s->param->fric_motor_param[i].param);
|
||||
}
|
||||
MOTOR_RM_Relax(&s->param->trig_motor_param);
|
||||
uint8_t fric_num = s->param->basic.fric_num;
|
||||
static float pos;
|
||||
if(s->mode==SHOOT_MODE_SAFE){
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
MOTOR_RM_Relax(&s->param->motor.fric[i].param);
|
||||
}
|
||||
MOTOR_RM_Relax(&s->param->motor.trig);\
|
||||
pos=s->target_variable.trig_angle=s->var_trig.trig_agl;
|
||||
}
|
||||
else{
|
||||
static float pos;
|
||||
switch(s->running_state)
|
||||
{
|
||||
|
||||
case SHOOT_STATE_IDLE:/*熄火等待*/
|
||||
for(int i=0;i<fric_num;i++)
|
||||
for(int i=0;i<fric_num;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->var_fric.normalized_fil_rpm[i],0,s->timer.dt);
|
||||
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]);
|
||||
MOTOR_RM_SetOutput(&s->param->fric_motor_param[i].param, s->output.lpfout_fric[i]);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.fric[i].param, s->output.lpfout_fric[i]);
|
||||
}
|
||||
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,pos,s->feedback.trig_agl,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.outagl_trig =PID_Calc(&s->pid.trig,pos,s->var_trig.trig_agl,0,s->timer.dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,s->output.outagl_trig,s->var_trig.trig_rpm,0,s->timer.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);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.trig, s->output.outlpf_trig);
|
||||
|
||||
/* 检查状态机 */
|
||||
if(cmd->ready)
|
||||
@ -292,46 +342,47 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
s->running_state=SHOOT_STATE_READY;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SHOOT_STATE_READY:/*准备射击*/
|
||||
Shoot_CaluTargetRPM(s,233);
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
uint8_t level=s->param->fric_motor_param->level-1;
|
||||
float target_rpm=s->param->ratio_multilevel[level]*s->target_variable.target_rpm;
|
||||
/* 计算跟随输出、计算修正输出 */
|
||||
a=s->target_variable.target_rpm/MAX_FRIC_RPM;
|
||||
uint8_t level=s->param->motor.fric[i].level-1;
|
||||
float target_rpm=s->param->basic.ratio_multilevel[level]
|
||||
*s->target_variable.fric_rpm/MAX_FRIC_RPM;
|
||||
/* 计算耦合控制权重 */
|
||||
float w=Shoot_CaluCoupledWeight(s,i);
|
||||
/* 计算跟随输出、计算修正输出 */
|
||||
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],
|
||||
target_rpm,
|
||||
s->feedback.fric_rpm[i],
|
||||
s->var_fric.normalized_fil_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],
|
||||
s->timer.dt);
|
||||
s->output.out_err[i]=w*PID_Calc(&s->pid.fric_err[i],
|
||||
s->var_fric.normalized_fil_avgrpm[s->param->motor.fric[i].level-1],
|
||||
s->var_fric.normalized_fil_rpm[i],
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.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]);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.fric[i].param, s->output.lpfout_fric[i]);
|
||||
}
|
||||
/* 设置拨弹电机输出 */
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,
|
||||
pos,
|
||||
s->feedback.trig_agl,
|
||||
s->var_trig.trig_agl,
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,
|
||||
s->output.outagl_trig,
|
||||
s->feedback.trig_rpm,
|
||||
s->var_trig.trig_rpm,
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.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);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.trig, s->output.outlpf_trig);
|
||||
|
||||
/* 检查状态机 */
|
||||
if(!cmd->ready)
|
||||
@ -340,23 +391,23 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
Shoot_ResetOutput(s);
|
||||
s->running_state=SHOOT_STATE_IDLE;
|
||||
}
|
||||
else if(last_firecmd==false&&cmd->firecmd==true)
|
||||
else if(last_firecmd==false&&cmd->firecmd==true)
|
||||
{
|
||||
s->running_state=SHOOT_STATE_FIRE;
|
||||
/* 根据模式设置待发射弹数 */
|
||||
switch(s->mode)
|
||||
{
|
||||
case SHOOT_MODE_SINGLE:
|
||||
s->anglecalu.num_to_shoot=1;
|
||||
s->var_trig.num_toShoot=1;
|
||||
break;
|
||||
case SHOOT_MODE_BURST:
|
||||
s->anglecalu.num_to_shoot=s->param->shot_burst_num;
|
||||
s->var_trig.num_toShoot=s->param->basic.shot_burst_num;
|
||||
break;
|
||||
case SHOOT_MODE_CONTINUE:
|
||||
s->anglecalu.num_to_shoot=6666;
|
||||
s->var_trig.num_toShoot=6666;
|
||||
break;
|
||||
default:
|
||||
s->anglecalu.num_to_shoot=0;
|
||||
s->var_trig.num_toShoot=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -366,46 +417,50 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
Shoot_CaluTargetAngle(s, cmd);
|
||||
for(int i=0;i<fric_num;i++)
|
||||
{
|
||||
uint8_t level=s->param->fric_motor_param->level-1;
|
||||
float target_rpm=s->param->ratio_multilevel[level]*s->target_variable.target_rpm;
|
||||
/* 计算跟随输出、计算修正输出 */
|
||||
uint8_t level=s->param->motor.fric[i].level-1;
|
||||
float target_rpm=s->param->basic.ratio_multilevel[level]
|
||||
*s->target_variable.fric_rpm/MAX_FRIC_RPM;
|
||||
/* 计算耦合控制权重 */
|
||||
float w=Shoot_CaluCoupledWeight(s,i);
|
||||
/* 计算跟随输出、计算修正输出 */
|
||||
s->output.out_follow[i]=PID_Calc(&s->pid.fric_follow[i],
|
||||
target_rpm,
|
||||
s->feedback.fric_rpm[i],
|
||||
s->var_fric.normalized_fil_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],
|
||||
s->timer.dt);
|
||||
s->output.out_err[i]=w*PID_Calc(&s->pid.fric_err[i],
|
||||
s->var_fric.normalized_fil_avgrpm[s->param->motor.fric[i].level-1],
|
||||
s->var_fric.normalized_fil_rpm[i],
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.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]);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.fric[i].param, s->output.lpfout_fric[i]);
|
||||
}
|
||||
/* 设置拨弹电机输出 */
|
||||
s->output.outagl_trig =PID_Calc(&s->pid.trig,
|
||||
s->target_variable.target_angle,
|
||||
s->feedback.trig_agl,
|
||||
s->target_variable.trig_angle,
|
||||
s->var_trig.trig_agl,
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,
|
||||
s->output.outagl_trig,
|
||||
s->feedback.trig_rpm,
|
||||
s->var_trig.trig_rpm,
|
||||
0,
|
||||
s->dt);
|
||||
s->timer.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);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.trig, s->output.outlpf_trig);
|
||||
|
||||
/* 检查状态机 */
|
||||
if(!cmd->firecmd)
|
||||
{
|
||||
s->running_state=SHOOT_STATE_READY;
|
||||
pos=s->feedback.trig_agl;
|
||||
s->running_state=SHOOT_STATE_READY;
|
||||
pos=s->var_trig.trig_agl;
|
||||
s->var_trig.num_toShoot=0;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -415,12 +470,12 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
}
|
||||
}
|
||||
/* 输出 */
|
||||
MOTOR_RM_Ctrl(&s->param->fric_motor_param[0].param);
|
||||
if(s->param->fric_num>4)
|
||||
MOTOR_RM_Ctrl(&s->param->motor.fric[0].param);
|
||||
if(s->param->basic.fric_num>4)
|
||||
{
|
||||
MOTOR_RM_Ctrl(&s->param->fric_motor_param[4].param);
|
||||
MOTOR_RM_Ctrl(&s->param->motor.fric[4].param);
|
||||
}
|
||||
MOTOR_RM_Ctrl(&s->param->trig_motor_param);
|
||||
MOTOR_RM_Ctrl(&s->param->motor.trig);
|
||||
last_firecmd = cmd->firecmd;
|
||||
return SHOOT_OK;
|
||||
}
|
||||
@ -438,61 +493,57 @@ int8_t Shoot_JamDetectionFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
if (s == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
if(s->param->jam_enable){
|
||||
switch (s->jamdetection.jamfsm_state) {
|
||||
if(s->param->jamDetection.enable){
|
||||
switch (s->jamdetection.fsmState) {
|
||||
case SHOOT_JAMFSM_STATE_NORMAL:/* 正常运行 */
|
||||
/* 检测电流是否超过阈值 */
|
||||
if (s->feedback.trig.feedback.torque_current/1000.0f > s->param->jam_threshold) {
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_SUSPECTED;
|
||||
s->jamdetection.jam_last_time = s->now; /* 记录怀疑开始时间 */
|
||||
if (s->feedback.trig.feedback.torque_current/1000.0f > s->param->jamDetection.threshold) {
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_SUSPECTED;
|
||||
s->jamdetection.lastTime = s->timer.now; /* 记录怀疑开始时间 */
|
||||
}
|
||||
/* 正常运行射击状态机 */
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
break;
|
||||
|
||||
case SHOOT_JAMFSM_STATE_SUSPECTED:/* 怀疑堵塞 */
|
||||
/* 检测电流是否低于阈值 */
|
||||
if (s->feedback.trig.feedback.torque_current/1000.0f < s->param->jam_threshold) {
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
if (s->feedback.trig.feedback.torque_current/1000.0f < s->param->jamDetection.threshold) {
|
||||
s->jamdetection.fsmState = 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;
|
||||
else if ((s->timer.now - s->jamdetection.lastTime) >= s->param->jamDetection.suspectedTime) {
|
||||
s->jamdetection.detected =true;
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_CONFIRMED;
|
||||
break;
|
||||
}
|
||||
/* 正常运行射击状态机 */
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
break;
|
||||
|
||||
case SHOOT_JAMFSM_STATE_CONFIRMED:/* 确认堵塞 */
|
||||
/* 清空待发射弹 */
|
||||
s->anglecalu.num_to_shoot=0;
|
||||
s->var_trig.num_toShoot=0;
|
||||
/* 修改拨弹盘目标角度 */
|
||||
s->target_variable.target_angle = s->feedback.trig_agl-(M_2PI/s->param->num_trig_tooth);
|
||||
s->target_variable.trig_angle = s->var_trig.trig_agl-(M_2PI/s->param->basic.num_trig_tooth);
|
||||
/* 切换状态 */
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_DEAL;
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_DEAL;
|
||||
/* 记录处理开始时间 */
|
||||
s->jamdetection.jam_last_time = s->now;
|
||||
|
||||
s->jamdetection.lastTime = s->timer.now;
|
||||
case SHOOT_JAMFSM_STATE_DEAL:/* 堵塞处理 */
|
||||
/* 正常运行射击状态机 */
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
/* 给予0.3秒响应时间并检测电流小于20A,认为堵塞已解除 */
|
||||
if ((s->now - s->jamdetection.jam_last_time)>=0.3f&&s->feedback.trig.feedback.torque_current/1000.0f < 20.0f) {
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
if ((s->timer.now - s->jamdetection.lastTime)>=0.3f&&s->feedback.trig.feedback.torque_current/1000.0f < 20.0f) {
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
s->jamdetection.jamfsm_state = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
s->jamdetection.jam_detected = false;
|
||||
s->jamdetection.fsmState = SHOOT_JAMFSM_STATE_NORMAL;
|
||||
s->jamdetection.detected = false;
|
||||
Shoot_RunningFSM(s, cmd);
|
||||
}
|
||||
|
||||
@ -513,71 +564,64 @@ int8_t Shoot_Init(Shoot_t *s, Shoot_Params_t *param, float target_freq)
|
||||
if (s == NULL || param == NULL || target_freq <= 0.0f) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
uint8_t fric_num = param->fric_num;
|
||||
|
||||
/* 分配内存 */
|
||||
uint8_t fric_num = param->basic.fric_num;
|
||||
s->param=param;
|
||||
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->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->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) {
|
||||
BSP_Free(s->feedback.fric);
|
||||
BSP_Free(s->feedback.fil_fric_rpm);
|
||||
BSP_Free(s->feedback.fric_rpm);
|
||||
BSP_Free(s->output.out_follow);
|
||||
BSP_Free(s->output.out_err);
|
||||
BSP_Free(s->output.out_fric);
|
||||
BSP_Free(s->output.lpfout_fric);
|
||||
BSP_Free(s->param->fric_motor_param);
|
||||
BSP_Free(s->pid.fric_follow);
|
||||
BSP_Free(s->pid.fric_err);
|
||||
BSP_Free(s->filter.fric.in);
|
||||
BSP_Free(s->filter.fric.out);
|
||||
return SHOOT_ERR_MALLOC;}
|
||||
|
||||
BSP_CAN_Init();
|
||||
/* 初始化摩擦轮PID和滤波器 */
|
||||
for(int i=0;i<fric_num;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_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.out[i], target_freq, s->param->filter.fric.out);
|
||||
MOTOR_RM_Register(¶m->motor.fric[i].param);
|
||||
PID_Init(&s->pid.fric_follow[i],
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.fric_follow);
|
||||
PID_Init(&s->pid.fric_err[i],
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.fric_err);
|
||||
LowPassFilter2p_Init(&s->filter.fric.in[i],
|
||||
target_freq,
|
||||
s->param->filter.fric.in);
|
||||
LowPassFilter2p_Init(&s->filter.fric.out[i],
|
||||
target_freq,
|
||||
s->param->filter.fric.out);
|
||||
}
|
||||
/* 初始化拨弹PID和滤波器 */
|
||||
MOTOR_RM_Register(¶m->trig_motor_param);
|
||||
switch(s->param->trig_motor_param.module)
|
||||
MOTOR_RM_Register(¶m->motor.trig);
|
||||
switch(s->param->motor.trig.module)
|
||||
{
|
||||
case MOTOR_M3508:
|
||||
PID_Init(&s->pid.trig, KPID_MODE_CALC_D, target_freq,¶m->trig_3508);
|
||||
PID_Init(&s->pid.trig_omg, KPID_MODE_CALC_D, target_freq,¶m->trig_omg_3508);
|
||||
PID_Init(&s->pid.trig,
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.trig_3508);
|
||||
PID_Init(&s->pid.trig_omg,
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.trig_omg_3508);
|
||||
break;
|
||||
case MOTOR_M2006:
|
||||
PID_Init(&s->pid.trig, KPID_MODE_CALC_D, target_freq,¶m->trig_2006);
|
||||
PID_Init(&s->pid.trig_omg, KPID_MODE_CALC_D, target_freq,¶m->trig_omg_2006);
|
||||
PID_Init(&s->pid.trig,
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.trig_2006);
|
||||
PID_Init(&s->pid.trig_omg,
|
||||
KPID_MODE_CALC_D,
|
||||
target_freq,
|
||||
¶m->pid.trig_omg_2006);
|
||||
break;
|
||||
default:
|
||||
return SHOOT_ERR_MOTOR;
|
||||
break;
|
||||
}
|
||||
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);
|
||||
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->anglecalu,0,sizeof(s->anglecalu));
|
||||
memset(&s->var_trig,0,sizeof(s->var_trig));
|
||||
return SHOOT_OK;
|
||||
}
|
||||
|
||||
@ -594,11 +638,13 @@ int8_t Shoot_Control(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
if (s == NULL || cmd == NULL) {
|
||||
return SHOOT_ERR_NULL; // 参数错误
|
||||
}
|
||||
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;
|
||||
s->timer.now = BSP_TIME_Get_us() / 1000000.0f;
|
||||
s->timer.dt = (BSP_TIME_Get_us() - s->timer.lask_wakeup) / 1000000.0f;
|
||||
s->timer.lask_wakeup = BSP_TIME_Get_us();
|
||||
Shoot_CaluTargetRPM(s,233);
|
||||
|
||||
Shoot_JamDetectionFSM(s, cmd);
|
||||
// Shoot_CalufeedbackRPM(s);
|
||||
return SHOOT_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -4,45 +4,44 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include <stdbool.h>
|
||||
#include "component/pid.h"
|
||||
#include "device/motor_rm.h"
|
||||
|
||||
|
||||
/* Exported constants ------------------------------------------------------- */
|
||||
#define MAX_FRIC_NUM 2
|
||||
#define MAX_NUM_MULTILEVEL 1 /* 多级发射级数 */
|
||||
|
||||
#define SHOOT_OK (0) /* 运行正常 */
|
||||
#define SHOOT_ERR_NULL (-1) /* 运行时发现NULL指针 */
|
||||
#define SHOOT_ERR_ERR (-2) /* 运行时发现了其他错误 */
|
||||
#define SHOOT_ERR_MODE (-3) /* 运行时配置了错误的Mode */
|
||||
#define SHOOT_ERR_MOTOR (-4) /* 运行时配置了不存在的电机类型 */
|
||||
#define SHOOT_ERR_MALLOC (-5) /* 内存分配失败 */
|
||||
|
||||
#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_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_IDLE = 0,/* 熄火 */
|
||||
SHOOT_STATE_READY, /* 准备射击 */
|
||||
SHOOT_STATE_FIRE /* 射击 */
|
||||
}Shoot_Running_State_t;
|
||||
|
||||
typedef enum {
|
||||
SHOOT_MODE_SAFE = 0, /* 安全模式 */
|
||||
SHOOT_MODE_SINGLE, /* 单发模式 */
|
||||
SHOOT_MODE_BURST, /* 多发模式 */
|
||||
SHOOT_MODE_CONTINUE /* 连发模式 */
|
||||
SHOOT_MODE_SAFE = 0,/* 安全模式 */
|
||||
SHOOT_MODE_SINGLE, /* 单发模式 */
|
||||
SHOOT_MODE_BURST, /* 多发模式 */
|
||||
SHOOT_MODE_CONTINUE,/* 连发模式 */
|
||||
SHOOT_MODE_NUM
|
||||
}Shoot_Mode_t;
|
||||
|
||||
typedef enum {
|
||||
@ -50,139 +49,141 @@ typedef enum {
|
||||
SHOOT_PROJECTILE_42MM,
|
||||
}Shoot_Projectile_t;
|
||||
|
||||
typedef struct {
|
||||
bool online; /* 遥控器在线 */
|
||||
bool mode; /* 射击模式 */
|
||||
bool ready; /* 准备射击 */
|
||||
bool firecmd; /* 射击指令 */
|
||||
}Shoot_CMD_t;
|
||||
|
||||
typedef struct{
|
||||
MOTOR_RM_Param_t param;
|
||||
uint8_t level; /*电机属于几级发射;1起始;num_multilevel大于1时有效,且不可大于num_multilevel*/
|
||||
uint8_t level; /* 电机属于第几级发射;1起始 */
|
||||
}Shoot_MOTOR_RM_Param_t;
|
||||
|
||||
typedef struct {
|
||||
MOTOR_Feedback_t *fric; /* 摩擦轮电机反馈 */
|
||||
MOTOR_RM_t trig; /* 拨弹电机反馈 */
|
||||
|
||||
float trig_agl; /*计算所有减速比后的拨弹盘的角度*/
|
||||
|
||||
float *fil_fric_rpm; /* 滤波后的摩擦轮转速 */
|
||||
float fil_trig_rpm; /* 滤波后的拨弹电机转速*/
|
||||
|
||||
float *fric_rpm; /* 归一化摩擦轮转速 */
|
||||
float fric_avgrpm; /* 归一化摩擦轮平均转速*/
|
||||
float trig_rpm; /* 归一化拨弹电机转速*/
|
||||
|
||||
MOTOR_Feedback_t fric[MAX_FRIC_NUM];/* 摩擦轮电机反馈 */
|
||||
MOTOR_RM_t trig; /* 拨弹电机反馈 */
|
||||
|
||||
}Shoot_Feedback_t;
|
||||
|
||||
typedef struct{
|
||||
float time_last_shoot;
|
||||
uint16_t num_to_shoot;
|
||||
uint16_t num_shooted;
|
||||
}Shoot_AngleCalu_t;
|
||||
float fil_rpm[MAX_FRIC_NUM]; /* 滤波后的摩擦轮原始转速 */
|
||||
float normalized_fil_rpm[MAX_FRIC_NUM]; /* 归一化摩擦轮转速 */
|
||||
float normalized_fil_avgrpm[MAX_NUM_MULTILEVEL]; /* 归一化摩擦轮平均转速 */
|
||||
float coupled_control_weights; /* 耦合控制权重 */
|
||||
}Shoot_VARSForFricCtrl_t;
|
||||
|
||||
typedef struct{
|
||||
float time_lastShoot;/* 上次射击时间 */
|
||||
uint16_t num_toShoot;/* 剩余待发射弹数 */
|
||||
uint16_t num_shooted;/* 已发射弹数 */
|
||||
|
||||
float trig_agl; /*计算所有减速比后的拨弹盘的角度*/
|
||||
float fil_trig_rpm; /* 滤波后的拨弹电机转速*/
|
||||
float trig_rpm; /* 归一化拨弹电机转速 */
|
||||
}Shoot_VARSForTrigCtrl_t;
|
||||
|
||||
typedef struct {
|
||||
bool jam_detected; /* 卡弹检测结果 */
|
||||
float jam_last_time;/* 用于记录怀疑状态或处理状态的开始时间 */
|
||||
Shoot_JamDetectionFSM_State_t jamfsm_state; /* 卡弹检测状态 */
|
||||
bool detected; /* 卡弹检测结果 */
|
||||
float lastTime;/* 用于记录怀疑状态或处理状态的开始时间 */
|
||||
Shoot_JamDetectionFSM_State_t fsmState; /* 卡弹检测状态机 */
|
||||
}Shoot_JamDetection_t;
|
||||
typedef struct {
|
||||
float *out_follow;
|
||||
float *out_err;
|
||||
float *out_fric;
|
||||
float *lpfout_fric;
|
||||
float out_follow[MAX_FRIC_NUM];
|
||||
float out_err[MAX_FRIC_NUM];
|
||||
float out_fric[MAX_FRIC_NUM];
|
||||
float lpfout_fric[MAX_FRIC_NUM];
|
||||
|
||||
|
||||
float outagl_trig;
|
||||
float outomg_trig;
|
||||
float outlpf_trig;
|
||||
}Shoot_Output_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
Shoot_Mode_t mode;/* 射击模式 */
|
||||
bool ready; /* 准备射击 */
|
||||
bool firecmd; /* 射击 */
|
||||
}Shoot_CMD_t;
|
||||
/* 底盘参数的结构体,包含所有初始化用的参数,通常是const,存好几组 */
|
||||
typedef struct {
|
||||
Shoot_Projectile_t proj;
|
||||
size_t fric_num; /* 摩擦轮数量 */
|
||||
|
||||
float extra_deceleration_ratio; /*电机出轴到拨盘的额外减速比;没有写1*/
|
||||
size_t num_trig_tooth; /* 拨弹盘每圈弹丸数量 */
|
||||
float shot_freq; /* 射击频率,单位Hz */
|
||||
size_t shot_burst_num; /* 多发模式一次射击的数量 */
|
||||
|
||||
size_t num_multilevel; /* 多级发射级数 (默认每级摩擦轮的数量相等)*/
|
||||
float *ratio_multilevel; /* 多级发射各级速度比例 */
|
||||
|
||||
bool jam_enable; /* 是否启用卡弹检测 */ //还没加到逻辑里
|
||||
float jam_threshold; /* 卡弹检测阈值,单位A (dji2006建议设置为120A,dji3508建议设置为235A,根据实际测试调整)*/
|
||||
float jam_suspected_time; /* 卡弹怀疑时间,单位秒 */
|
||||
|
||||
Shoot_MOTOR_RM_Param_t *fric_motor_param;
|
||||
MOTOR_RM_Param_t trig_motor_param;
|
||||
|
||||
|
||||
KPID_Params_t fric_follow; /* 摩擦轮电机PID控制参数,用于跟随目标速度 */
|
||||
KPID_Params_t fric_err; /* 摩擦轮电机PID控制参数,用于消除转速误差 */
|
||||
KPID_Params_t trig_2006; /* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_omg_2006; /* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_3508; /* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_omg_3508; /* 拨弹电机PID控制参数 */
|
||||
/* 低通滤波器截止频率 */
|
||||
struct{
|
||||
Shoot_Projectile_t projectileType; /* 发射弹丸类型 */;
|
||||
size_t fric_num; /* 摩擦轮电机数量 */
|
||||
float ratio_multilevel[MAX_NUM_MULTILEVEL]; /* 多级发射各级速度比例 */
|
||||
float extra_deceleration_ratio; /*电机出轴到拨盘的额外减速比;没有写1*/
|
||||
size_t num_trig_tooth; /* 拨弹盘每圈弹丸数量 */
|
||||
float shot_freq; /* 射击频率,单位Hz */
|
||||
size_t shot_burst_num; /* 多发模式一次射击的数量 */
|
||||
}basic;/* 发射基础参数 */
|
||||
struct {
|
||||
bool enable; /* 是否启用卡弹检测 */
|
||||
float threshold; /* 卡弹检测阈值,单位A (dji2006建议设置为120A,dji3508建议设置为235A,根据实际测试调整)*/
|
||||
float suspectedTime;/* 卡弹怀疑时间,单位秒 */
|
||||
}jamDetection;/* 卡弹检测参数 */
|
||||
struct {
|
||||
Shoot_MOTOR_RM_Param_t fric[MAX_FRIC_NUM];
|
||||
MOTOR_RM_Param_t trig;
|
||||
}motor; /* 电机参数 */
|
||||
struct{
|
||||
KPID_Params_t fric_follow; /* 摩擦轮电机PID控制参数,用于跟随目标速度 */
|
||||
KPID_Params_t fric_err; /* 摩擦轮电机PID控制参数,用于消除转速误差 */
|
||||
KPID_Params_t trig_2006; /* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_omg_2006;/* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_3508; /* 拨弹电机PID控制参数 */
|
||||
KPID_Params_t trig_omg_3508;/* 拨弹电机PID控制参数 */
|
||||
}pid; /* PID参数 */
|
||||
struct {
|
||||
struct{
|
||||
float in; /* 反馈值滤波器 */
|
||||
float out; /* 输出值滤波器 */
|
||||
float in; /* 反馈值滤波器截止频率 */
|
||||
float out; /* 输出值滤波器截止频率 */
|
||||
}fric;
|
||||
struct{
|
||||
float in; /* 反馈值滤波器 */
|
||||
float out; /* 输出值滤波器 */
|
||||
float in; /* 反馈值滤波器截止频率 */
|
||||
float out; /* 输出值滤波器截止频率 */
|
||||
}trig;
|
||||
} filter;
|
||||
} filter;/* 滤波器截止频率参数 */
|
||||
} Shoot_Params_t;
|
||||
|
||||
typedef struct {
|
||||
float now; /* 当前时间,单位秒 */
|
||||
uint64_t lask_wakeup; /* 上次唤醒时间,单位微秒 */
|
||||
float dt; /* 两次唤醒间隔时间,单位秒 */
|
||||
}Shoot_Timer_t;
|
||||
|
||||
/*
|
||||
* 运行的主结构体,所有这个文件里的函数都在操作这个结构体
|
||||
* 包含了初始化参数,中间变量,输出变量
|
||||
*/
|
||||
typedef struct {
|
||||
bool online; /*在线检测*/
|
||||
float now; /* 当前时间,单位秒 */
|
||||
uint64_t lask_wakeup; /* 上次唤醒时间,单位微秒 */
|
||||
float dt; /* 两次唤醒间隔时间,单位秒 */
|
||||
Shoot_Params_t *param; /* 发射参数 */
|
||||
Shoot_Timer_t timer; /* 计时器 */
|
||||
Shoot_Params_t *param; /* 发射参数 */
|
||||
/* 模块通用 */
|
||||
Shoot_Running_State_t running_state; /* 运行状态机 */
|
||||
Shoot_Mode_t mode; /* 射击模式 */
|
||||
Shoot_Mode_t mode; /* 射击模式 */
|
||||
/* 反馈信息 */
|
||||
Shoot_Feedback_t feedback; /* 反馈信息 */
|
||||
/* 控制信息*/
|
||||
Shoot_JamDetection_t jamdetection; /* 卡弹检测控制信息 */
|
||||
Shoot_AngleCalu_t anglecalu; /* 角度计算控制信息 */
|
||||
Shoot_Output_t output; /* 输出信息 */
|
||||
Shoot_Feedback_t feedback;
|
||||
/* 控制信息*/
|
||||
Shoot_Running_State_t running_state; /* 运行状态机 */
|
||||
Shoot_JamDetection_t jamdetection; /* 卡弹检测控制信息 */
|
||||
Shoot_VARSForFricCtrl_t var_fric; /* 摩擦轮控制信息 */
|
||||
Shoot_VARSForTrigCtrl_t var_trig; /* 角度计算控制信息 */
|
||||
Shoot_Output_t output; /* 输出信息 */
|
||||
/* 目标控制量 */
|
||||
struct {
|
||||
float target_rpm; /* 目标摩擦轮转速 */
|
||||
float target_angle; /* 目标拨弹位置 */
|
||||
float fric_rpm; /* 目标摩擦轮转速 */
|
||||
float trig_angle;/* 目标拨弹位置 */
|
||||
}target_variable;
|
||||
|
||||
/* 反馈控制用的PID */
|
||||
struct {
|
||||
KPID_t *fric_follow; /* 摩擦轮PID主结构体 */
|
||||
KPID_t *fric_err; /* 摩擦轮PID主结构体 */
|
||||
KPID_t trig; /* 拨弹PID主结构体 */
|
||||
KPID_t trig_omg; /* 拨弹PID主结构体 */
|
||||
KPID_t fric_follow[MAX_FRIC_NUM];/* 摩擦轮PID主结构体 */
|
||||
KPID_t fric_err[MAX_FRIC_NUM]; /* 摩擦轮PID主结构体 */
|
||||
KPID_t trig; /* 拨弹PID主结构体 */
|
||||
KPID_t trig_omg; /* 拨弹PID主结构体 */
|
||||
} pid;
|
||||
|
||||
/* 滤波器 */
|
||||
struct {
|
||||
struct{
|
||||
LowPassFilter2p_t *in; /* 反馈值滤波器 */
|
||||
LowPassFilter2p_t *out; /* 输出值滤波器 */
|
||||
LowPassFilter2p_t in[MAX_FRIC_NUM]; /* 反馈值滤波器 */
|
||||
LowPassFilter2p_t out[MAX_FRIC_NUM];/* 输出值滤波器 */
|
||||
}fric;
|
||||
struct{
|
||||
LowPassFilter2p_t in; /* 反馈值滤波器 */
|
||||
LowPassFilter2p_t out; /* 输出值滤波器 */
|
||||
LowPassFilter2p_t in; /* 反馈值滤波器 */
|
||||
LowPassFilter2p_t out;/* 输出值滤波器 */
|
||||
}trig;
|
||||
} filter;
|
||||
|
||||
@ -220,7 +221,7 @@ int8_t Shoot_SetMode(Shoot_t *s, Shoot_Mode_t mode);
|
||||
*
|
||||
* \return 函数运行结果
|
||||
*/
|
||||
int8_t Chassis_UpdateFeedback(Shoot_t *s);
|
||||
int8_t Shoot_UpdateFeedback(Shoot_t *s);
|
||||
|
||||
/**
|
||||
* \brief 初始化发射
|
||||
|
||||
@ -36,7 +36,6 @@ void Task_shoot_ctrl(void *argument) {
|
||||
|
||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||
/* USER CODE INIT BEGIN */
|
||||
Config_ShootInit();
|
||||
Shoot_Init(&shoot,&Config_GetRobotParam()->shoot_param,SHOOT_CTRL_FREQ);
|
||||
Shoot_SetMode(&shoot,SHOOT_MODE_SINGLE);
|
||||
/* USER CODE INIT END */
|
||||
@ -53,9 +52,8 @@ void Task_shoot_ctrl(void *argument) {
|
||||
// shoot_cmd.firecmd =shoot_ctrl_cmd_rc.shoot.firecmd;
|
||||
shoot.mode=s_mode.S_Mode;
|
||||
// shoot_cmd.mode=true;
|
||||
shoot.target_variable.target_rpm=4000;
|
||||
|
||||
Chassis_UpdateFeedback(&shoot);
|
||||
Shoot_UpdateFeedback(&shoot);
|
||||
Shoot_Control(&shoot,&shoot_cmd);
|
||||
/* USER CODE END */
|
||||
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user