This commit is contained in:
yunhai8432 2025-11-12 21:28:17 +08:00
parent 0fa8329aa4
commit 445e5bb93f
14 changed files with 1506 additions and 1642 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

@ -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: Wed Nov 12 20:41:26 2025
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 6160001: Last Updated: Wed Nov 12 21:26:23 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>
@ -169,9 +169,9 @@ Global Symbols
<P><STRONG><a name="[248]"></a>__scatterload_null</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __scatter.o(!!!scatter), UNUSED)
<P><STRONG><a name="[249]"></a>__decompress</STRONG> (Thumb, 90 bytes, Stack size unknown bytes, __dczerorl2.o(!!dczerorl2), UNUSED)
<P><STRONG><a name="[249]"></a>__decompress</STRONG> (Thumb, 58 bytes, Stack size unknown bytes, __dczerorl.o(!!dczerorl), UNUSED)
<P><STRONG><a name="[24a]"></a>__decompress1</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __dczerorl2.o(!!dczerorl2), UNUSED)
<P><STRONG><a name="[24a]"></a>__decompress0</STRONG> (Thumb, 0 bytes, Stack size unknown bytes, __dczerorl.o(!!dczerorl), UNUSED)
<P><STRONG><a name="[24b]"></a>__scatterload_zeroinit</STRONG> (Thumb, 28 bytes, Stack size unknown bytes, __scatter_zi.o(!!handler_zi), UNUSED)
@ -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, 1312 bytes, Stack size 88 bytes, gimbal.o(.text.Gimbal_Control))
<P><STRONG><a name="[eb]"></a>Gimbal_Control</STRONG> (Thumb, 1304 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
@ -1128,7 +1128,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="[f3]"></a>Gimbal_Init</STRONG> (Thumb, 424 bytes, Stack size 32 bytes, gimbal.o(.text.Gimbal_Init))
<P><STRONG><a name="[f3]"></a>Gimbal_Init</STRONG> (Thumb, 472 bytes, Stack size 32 bytes, gimbal.o(.text.Gimbal_Init))
<BR><BR>[Stack]<UL><LI>Max Depth = 372 + Unknown Stack Size
<LI>Call Chain = Gimbal_Init &rArr; BSP_CAN_Init &rArr; osMutexNew &rArr; xQueueCreateMutexStatic &rArr; prvInitialiseMutex &rArr; xQueueGenericSend &rArr; prvCopyDataToQueue &rArr; xTaskPriorityDisinherit &rArr; vListInsertEnd
</UL>

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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
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)(0x69148074)(-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)(0x69147C6E)
F (..\User\module\gimbal.c)(0x69148AFD)(-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)(0x691489EC)
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)(0x69143650)(-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)(0x691488E2)(-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)(0x69147C6E)
I (..\User\module\gimbal.h)(0x691489EC)
I (..\User\component\ahrs.h)(0x68F3410E)
I (..\User\component\filter.h)(0x68F22FA9)
I (..\User\component\pid.h)(0x68F22FA9)

Binary file not shown.

View File

@ -23,8 +23,8 @@ Config_RobotParam_t robot_config = {
.Set_Limit_t= {
.pit_max=0.69,
.pit_min=-0.47,
.yaw_max= 1.0,//yaw的
.yaw_min=-1.0,
// .yaw_max= 1.0,//yaw的
// .yaw_min=-1.0,
},
@ -39,7 +39,7 @@ Config_RobotParam_t robot_config = {
},
/*零点参数*/
.gimbal_zero={
.zero={
.pit_encoder=0,
.yaw_encoder=0,
/*零点行程*/

View File

@ -123,8 +123,12 @@ int8_t Gimbal_Init(Gimbal_t *g,Gimbal_Params_t *param,
g->limit.set_yaw.max=g->param->Set_Limit_t.yaw_max;
g->limit.set_yaw.min=g->param->Set_Limit_t.yaw_min;
g->zero.yaw=g->param->zero.yaw;
g->zero.pit=g->param->zero.pit;
g->zero.yaw_encoder=g->param->zero.yaw_encoder;
g->zero.pit_encoder=g->param->zero.pit_encoder;
g->zero.travel.yaw=g->param->zero.travel.yaw;
g->zero.travel.pit=g->param->zero.travel.pit;
BSP_CAN_Init();
/*大疆电机注册*/
@ -291,8 +295,8 @@ int8_t Gimbal_Control(Gimbal_t *g, Gimbal_CMD_t *g_cmd) {
break;
case GIMBAL_MODE_RELATIVE:
/*计算零点*/
g->param->gimbal_zero.yaw = g->param->gimbal_zero.yaw_encoder - g->param->gimbal_zero.travel.yaw;
g->param->gimbal_zero.pit = g->param->gimbal_zero.pit_encoder - g->param->gimbal_zero.travel.pit;
g->zero.yaw = g->zero.yaw_encoder - g->zero.travel.yaw;
g->zero.pit = g->zero.pit_encoder - g->zero.travel.pit;
/*基于零点的设定角度*/
/*加的相对角度应该限制在3.14~-3.14*/
CircleAdd(&(g->relative_angle.yaw),delta_yaw,M_2PI);
@ -300,8 +304,8 @@ int8_t Gimbal_Control(Gimbal_t *g, Gimbal_CMD_t *g_cmd) {
g->relative_angle.pit=+delta_pit;
g->setpoint.eulr.yaw=g->param->gimbal_zero.yaw + g->relative_angle.yaw;
g->setpoint.eulr.pit=g->param->gimbal_zero.pit + g->relative_angle.pit;
g->setpoint.eulr.yaw=g->zero.yaw + g->relative_angle.yaw;
g->setpoint.eulr.pit=g->zero.pit + g->relative_angle.pit;
/*yaw的限位*/
if (g->param->motor.limit_yaw==true)

View File

@ -47,6 +47,16 @@ typedef struct {
float min;
} Gimbal_Limit_t;
typedef struct{
struct{
float yaw; /* 零点行程 */
float pit;
}travel;
float pit; /*零点*/
float yaw;
float pit_encoder; /*零点*/
float yaw_encoder;
} Gimbal_zero_t;
typedef struct {
bool limit_yaw;/*是否开启限位*/
@ -59,13 +69,13 @@ typedef struct {
MOTOR_RM_Param_t pit_rm_motor; /* pitch轴电机参数 */
MOTOR_RM_Param_t yaw_rm_motor; /* yaw轴电机参数 */
} Gimbal_MOTOR_Param_t;
}Gimbal_MOTOR_Param_t;
/* 云台参数的结构体包含所有初始化用的参数通常是const存好几组。*/
typedef struct {
Gimbal_MOTOR_Param_t motor;
Gimbal_zero_t zero;
struct {
KPID_Params_t yaw_omega; /* yaw轴角速度环PID参数 */
@ -103,22 +113,8 @@ typedef struct {
float pit_min;
float yaw_max; /*yaw的限位*/
float yaw_min;
}Set_Limit_t;
struct {
struct{
float yaw; /* 零点行程 */
float pit;
}travel;
float pit; /*零点*/
float yaw;
float pit_encoder; /*零点*/
float yaw_encoder;
}gimbal_zero;
@ -165,6 +161,7 @@ typedef struct {
/* 模块通用 */
Gimbal_Mode_t mode; /* 云台模式 */
Gimbal_MOTOR MOTOR;
Gimbal_zero_t zero;
/* PID计算的目标值 */
struct {
AHRS_Eulr_t eulr; /* 表示云台姿态的欧拉角 */
@ -185,7 +182,6 @@ typedef struct {
} pid;
struct {
Gimbal_Limit_t set_yaw;
Gimbal_Limit_t set_pit;
} limit;