gimbal/User/module/config.c

149 lines
3.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* 配置相关
*/
/* Includes ----------------------------------------------------------------- */
#include "user_math.h"
#include "module/config.h"
#include "bsp/can.h"
/* Private typedef ---------------------------------------------------------- */
/* Private define ----------------------------------------------------------- */
/* Private macro ------------------------------------------------------------ */
/* Private variables -------------------------------------------------------- */
/* Exported variables ------------------------------------------------------- */
// 机器人参数配置
Config_RobotParam_t robot_config = {
.gimbal_param = {
/*欧拉角限位和电机角度限位*/
.Set_Limit_t= {
.pit_max=0.69,
.pit_min=-0.47,
.yaw_max=0,
.yaw_min=0,
.pit_ecd_max=0,
.pit_ecd_min=0,
.yaw_ecd_max=0,
.yaw_ecd_min=0,
},
// .mech_zero = {
// .yaw = 0.0f,
// .pit = -0.69f,
// },
/*是否启动限位,1启动-1不启动
一般pit统一限位*/
.travel = {
.yaw = -1.0f,
.pit = 1.0f,
.ecd_yaw=-1.0f,
.ecd_pit=1.0f,
},
.pit_motor={BSP_CAN_2,0x20A,MOTOR_GM6020,false,false},
.yaw_motor={BSP_CAN_2,0x209,MOTOR_GM6020,false,false},
.low_pass_cutoff_freq = {
.out = -1.0f,
.gyro = 1000.0f,
},
.pid = {
/*欧拉角控制参数*/
.yaw_omega = {
.k = 0.45f,
.p = 1.0f,
.i = 6.0f,
.d = 0.0008f,//0
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.yaw_angle = {
.k = 10.0f,
.p = 2.0f ,
.i = 0.0f,
.d = 0.0f,
.i_limit = 0.0f,
.out_limit = 10.0f,
.d_cutoff_freq = -1.0f,
.range = M_2PI,
},
.pit_omega = {
.k = 0.25f,
.p = 1.0f,
.i = 0.0f,
.d = 0.001901f,
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.pit_angle = {
.k = 12.0f,
.p = 2.1,
.i = 0.0f,
.d = 0.0f,
.i_limit = 0.0f,
.out_limit = 10.0f,
.d_cutoff_freq = -1.0f,
.range = M_2PI,
},
/*电机控制参数*/
.yaw_velocity = {
.k = 0.0f,
.p = 0.0f,
.i = 0.0f,
.d = 0.000f,//0
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.yaw_ecd_angle = {
.k = 0.0f,
.p = 0.0f ,
.i = 0.0f,
.d = 0.0f,
.i_limit = 0.0f,
.out_limit = 10.0f,
.d_cutoff_freq = -1.0f,
.range = M_2PI,
},
.pit_velocity = {
.k = 0.0f,
.p = 0.0f,
.i = 0.0f,
.d = 0.0f,
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.pit_ecd_angle = {
.k = 0.0f,
.p = 0.0f,
.i = 0.0f,
.d = 0.0f,
.i_limit = 0.0f,
.out_limit = 10.0f,
.d_cutoff_freq = -1.0f,
.range = M_2PI,
},
}
},
};
/**
* @brief 获取机器人配置参数
* @return 机器人配置参数指针
*/
Config_RobotParam_t* Config_GetRobotParam(void) {
return &robot_config;
}