gimbal/User/module/config.c

92 lines
2.3 KiB
C

/*
* 配置相关
*/
/* 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 = {
.mech_zero = {
.yaw = 0.0f,
.pit = -0.69f,
},
.travel = {
.yaw = 1.0f,
.pit = 1.16f,
},
.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 = 1.0f,
.p = 1.0f,
.i = 0.0f,
.d = 0.0f,
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.yaw_angle = {
.k = 10.0f,
.p = 2.7f,
.i = 11.9f,
.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.0f,
.i_limit = 1.0f,
.out_limit = 1.0f,
.d_cutoff_freq = -1.0f,
.range = -1.0f,
},
.pit_angle = {
.k = 20.0f,
.p = 2.0f,
.i = 15.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;
}