先留着

This commit is contained in:
yunhai8432 2025-11-01 22:12:39 +08:00
parent 8fa85eb88a
commit ffb26fc9e3
15 changed files with 1611 additions and 1636 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -31,15 +31,9 @@ Note: source file '..\User\bsp\can.c' - object file renamed from 'gimbal\can.o'
Note: source file '..\User\bsp\gpio.c' - object file renamed from 'gimbal\gpio.o' to 'gimbal\gpio_1.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'.
compiling gimbal_ctrl.c...
compiling ai.c...
compiling init.c...
compiling remote.c...
compiling config.c...
compiling gimbal.c...
compiling atti_esti.c...
linking...
Program Size: Code=84384 RO-data=996 RW-data=416 ZI-data=34280
Program Size: Code=84448 RO-data=996 RW-data=424 ZI-data=34272
"gimbal\gimbal.axf" - 0 Error(s), 0 Warning(s).
<h2>Software Packages used:</h2>

View File

@ -3,7 +3,7 @@
<title>Static Call Graph - [gimbal\gimbal.axf]</title></head>
<body><HR>
<H1>Static Call Graph for image gimbal\gimbal.axf</H1><HR>
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 6160001: Last Updated: Tue Oct 28 22:17:10 2025
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 6160001: Last Updated: Sat Nov 1 22:06:33 2025
<BR><P>
<H3>Maximum Stack Usage = 432 bytes + Unknown(Functions without stacksize, Cycles, Untraceable Function Pointers)</H3><H3>
Call chain for Maximum Stack Depth:</H3>
@ -1114,7 +1114,7 @@ Global Symbols
<LI><a href="#[197]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;MX_CAN1_Init
</UL>
<P><STRONG><a name="[eb]"></a>Gimbal_Control</STRONG> (Thumb, 1016 bytes, Stack size 88 bytes, gimbal.o(.text.Gimbal_Control))
<P><STRONG><a name="[eb]"></a>Gimbal_Control</STRONG> (Thumb, 1000 bytes, Stack size 88 bytes, gimbal.o(.text.Gimbal_Control))
<BR><BR>[Stack]<UL><LI>Max Depth = 208<LI>Call Chain = Gimbal_Control &rArr; PID_Calc &rArr; LowPassFilter2p_Apply &rArr; __ARM_isinf
</UL>
<BR>[Calls]<UL><LI><a href="#[f0]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;Clip
@ -1142,7 +1142,7 @@ Global Symbols
<BR>[Called By]<UL><LI><a href="#[70]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;Task_gimbal_ctrl
</UL>
<P><STRONG><a name="[f9]"></a>Gimbal_Output</STRONG> (Thumb, 174 bytes, Stack size 16 bytes, gimbal.o(.text.Gimbal_Output))
<P><STRONG><a name="[f9]"></a>Gimbal_Output</STRONG> (Thumb, 274 bytes, Stack size 16 bytes, gimbal.o(.text.Gimbal_Output))
<BR><BR>[Stack]<UL><LI>Max Depth = 248<LI>Call Chain = Gimbal_Output &rArr; MOTOR_DM_MITCtrl &rArr; MOTOR_DM_SendMITCmd &rArr; BSP_CAN_TransmitStdDataFrame &rArr; BSP_CAN_Transmit &rArr; BSP_CAN_TxQueuePush
</UL>
<BR>[Calls]<UL><LI><a href="#[fc]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;MOTOR_DM_MITCtrl
@ -4974,7 +4974,7 @@ Local Symbols
<BR>[Called By]<UL><LI><a href="#[18e]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;MOTOR_DM_ParseFeedbackFrame
</UL>
<P><STRONG><a name="[ee]"></a>Gimbal_SetMode</STRONG> (Thumb, 188 bytes, Stack size 24 bytes, gimbal.o(.text.Gimbal_SetMode))
<P><STRONG><a name="[ee]"></a>Gimbal_SetMode</STRONG> (Thumb, 180 bytes, Stack size 24 bytes, gimbal.o(.text.Gimbal_SetMode))
<BR><BR>[Stack]<UL><LI>Max Depth = 120<LI>Call Chain = Gimbal_SetMode &rArr; PID_Reset &rArr; LowPassFilter2p_Reset &rArr; LowPassFilter2p_Apply &rArr; __ARM_isinf
</UL>
<BR>[Calls]<UL><LI><a href="#[fd]">&gt;&gt;</a>&nbsp;&nbsp;&nbsp;PID_Reset

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -2126,7 +2126,7 @@ I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
I (D:\Keil_v5\ARM\ARMCLANG\include\stdbool.h)(0x6035A4A8)
I (D:\Keil_v5\ARM\ARMCLANG\include\stdint.h)(0x6035A4A8)
I (D:\Keil_v5\ARM\ARMCLANG\include\stddef.h)(0x6035A4A8)
I (..\User\module\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\filter.h)(0x68F22FA9)
I (..\User\component\pid.h)(0x68F22FA9)
@ -2264,7 +2264,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\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\user_math.h)(0x68F22FA9)
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
@ -2376,7 +2376,7 @@ I (..\User\component\pid.h)(0x68F22FA9)
I (..\User\component\filter.h)(0x68F22FA9)
I (..\User\device\bmi088.h)(0x68F22F87)
I (..\User\device\device.h)(0x68F22FA9)
I (..\User\module\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\device\motor.h)(0x68F22F87)
I (..\User\device\motor_dm.h)(0x68F22F87)
I (..\User\bsp\can.h)(0x68F22FA9)
@ -2407,7 +2407,7 @@ I (..\User\component\user_math.h)(0x68F22FA9)
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\module\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\filter.h)(0x68F22FA9)
I (..\User\component\pid.h)(0x68F22FA9)
@ -2481,7 +2481,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\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\user_math.h)(0x68F22FA9)
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
@ -2534,8 +2534,8 @@ I (..\User\device\motor_rm.h)(0x68F22F87)
I (..\User\module\config.h)(0x68DD3463)
I (..\User\device\motor_lz.h)(0x68F22F87)
I (..\User\device\motor_lk.h)(0x68F22F87)
F (..\User\module\gimbal.c)(0x6900D050)(-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/gimbal.o -MD)
I (..\User\module\gimbal.h)(0x6900D064)
F (..\User\module\gimbal.c)(0x690613C5)(-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/gimbal.o -MD)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\user_math.h)(0x68F22FA9)
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
@ -2598,7 +2598,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)(0x68F22F87)
I (..\User\bsp\time.h)(0x68F22FA9)
F (..\User\module\config.c)(0x6900D050)(-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)(0x690613E7)(-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)(0x68F22FA9)
I (D:\Keil_v5\ARM\ARMCLANG\include\float.h)(0x6035A4A0)
I (D:\Keil_v5\ARM\ARMCLANG\include\math.h)(0x6035A4A8)
@ -2658,7 +2658,7 @@ I (..\Middlewares\Third_Party\FreeRTOS\Source\include\task.h)(0x68B055DB)
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_lk.h)(0x68F22F87)
I (..\User\module\gimbal.h)(0x6900D064)
I (..\User\module\gimbal.h)(0x690613C5)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\filter.h)(0x68F22FA9)
I (..\User\component\pid.h)(0x68F22FA9)

Binary file not shown.

View File

@ -57,7 +57,13 @@ Config_RobotParam_t robot_config = {
.pit_dm_motor={},
.yaw_dm_motor={},
},
.dm_Params_t={
.yaw_dm={.kd=0.3,},
.yaw_dm_Reduction_ratio=8.0f,//减速比
.pit_dm={.kd=1.0,},
.pit_dm_Reduction_ratio=5.0f,
},
.low_pass_cutoff_freq = {
.out = -1.0f,
.gyro = 1000.0f,

View File

@ -61,7 +61,6 @@ static int8_t Gimbal_SetMode(Gimbal_t *g, Gimbal_Mode_t mode) {
g->setpoint.eulr.pit = g->feedback.imu.eulr.pit;
g->setpoint.eulr.yaw = g->feedback.imu.eulr.yaw;
g->setpoint.small_yaw = g->feedback.imu.eulr.yaw;
g->setpoint.ecd.pit=g->feedback.motor.pit.rotor_abs_angle;
g->setpoint.ecd.yaw=g->feedback.motor.yaw.rotor_abs_angle;
@ -260,7 +259,6 @@ int8_t Gimbal_Control(Gimbal_t *g, Gimbal_CMD_t *g_cmd) {
case GIMBAL_MODE_ABSOLUTE:/*绝对模式*/
g->setpoint.eulr.yaw+=delta_yaw;
g->setpoint.small_yaw+=delta_yaw;
if (g->param->travel.yaw > 0)
Clip(&(g->setpoint.eulr.yaw),delta_min,delta_max);
else{
@ -345,12 +343,26 @@ void Gimbal_Output(Gimbal_t *g){
/*达妙电机输出*/
if(g->param->motor.pit==DM){
g->out.pit_dm.torque= g->out.pit * 5.0f; // 乘以减速比
g->out.pit_dm.angle=g->param->dm_Params_t.pit_dm.angle;
g->out.pit_dm.kd=g->param->dm_Params_t.pit_dm.kd;
g->out.pit_dm.kp=g->param->dm_Params_t.pit_dm.kp;
g->out.pit_dm.velocity=g->param->dm_Params_t.pit_dm.velocity;
g->out.pit_dm.torque= g->out.pit * g->param->dm_Params_t.pit_dm_Reduction_ratio; // 乘以减速比
MOTOR_DM_MITCtrl(&g->param->motor.pit_dm_motor,&(g->out.pit_dm));
}
if(g->param->motor.yaw==DM){
g->out.yaw_dm.torque= g->out.yaw * 5.0f; // 乘以减速比
g->out.yaw_dm.angle=g->param->dm_Params_t.yaw_dm.angle;
g->out.yaw_dm.kd=g->param->dm_Params_t.yaw_dm.kd;
g->out.yaw_dm.kp=g->param->dm_Params_t.yaw_dm.kp;
g->out.yaw_dm.velocity=g->param->dm_Params_t.yaw_dm.velocity;
g->out.yaw_dm.torque= g->out.yaw * g->param->dm_Params_t.yaw_dm_Reduction_ratio; // 乘以减速比
MOTOR_DM_MITCtrl(&g->param->motor.yaw_dm_motor,&(g->out.yaw_dm));
}
}

View File

@ -110,6 +110,8 @@ typedef struct {
struct {
MOTOR_MIT_Output_t yaw_dm; /*达妙的参数*/
MOTOR_MIT_Output_t pit_dm;
float yaw_dm_Reduction_ratio;
float pit_dm_Reduction_ratio;
}dm_Params_t;
} Gimbal_Params_t;
@ -130,7 +132,6 @@ typedef struct {
typedef struct {
float yaw; /* yaw轴电机输出 */
float pit; /* pitch轴电机输出 */
float small_yaw; /* 小yaw轴电机输出 */
MOTOR_MIT_Output_t yaw_dm; /*达妙的参数*/
MOTOR_MIT_Output_t pit_dm;
@ -153,7 +154,6 @@ typedef struct {
struct {
AHRS_Eulr_t eulr; /* 表示云台姿态的欧拉角 */
AHRS_Eulr_t ecd;
float small_yaw
} setpoint;
struct {