123 lines
2.4 KiB
C
123 lines
2.4 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 = {
|
||
/* 云台欧拉角与角速度自由选择 */
|
||
.Direction={
|
||
.Eulr={
|
||
.pit=Pit,
|
||
.yaw=Yaw,
|
||
},
|
||
.Gyro={
|
||
.pit=Gyro_x,
|
||
.yaw=Gyro_z,
|
||
},
|
||
},
|
||
/* 现在只是电机测试的参数,如果用陀J需给大 */
|
||
.smc={
|
||
.yaw={
|
||
.u_max=1.0f, //输出限幅
|
||
.J=1.0,
|
||
.limit=5.1f, //饱和函数上下限
|
||
.K=1.6,
|
||
.c=0.6,
|
||
.epsilon=0.05,
|
||
},
|
||
.pit={
|
||
.u_max=1.0f, //输出限幅
|
||
.J=1.0,
|
||
.limit=5.1f, //饱和函数上下限
|
||
.K=1.6,
|
||
.c=0.6,
|
||
.epsilon=0.05,
|
||
.c1=1.0, //EIsmc参数
|
||
.c2=1.0, //EIsmc参数
|
||
},
|
||
},
|
||
|
||
|
||
/*欧拉角限位和电机角度限位*/
|
||
.Limit_t= {
|
||
.pit_max=0.69,
|
||
.pit_min=-0.47,
|
||
/*零点参数*/
|
||
.zero={
|
||
.yaw_encoder=0,
|
||
|
||
.travel={
|
||
.yaw=1.06,
|
||
},
|
||
},
|
||
},
|
||
|
||
|
||
.feedforward={
|
||
.imu = {
|
||
.yaw=false,
|
||
.pit=false,
|
||
.K_yaw=0,
|
||
.K_pit=0,
|
||
},
|
||
|
||
},
|
||
|
||
|
||
|
||
.motor={
|
||
/*按自己需求选择电机*/
|
||
.pit=DM,
|
||
.yaw=RM,
|
||
/*是否开启限位*/
|
||
.limit_yaw=false,
|
||
.limit_pit=true,
|
||
.pit_rm_motor={BSP_CAN_2,0x20A,MOTOR_GM6020,false,false},
|
||
.yaw_rm_motor={BSP_CAN_1,0x205,MOTOR_GM6020,false,false},
|
||
/*达妙电机参数自己配*/
|
||
.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,
|
||
.gyro_x=200.0f,
|
||
.gyro_y=200.0f,
|
||
.gyro_z=200.0f,
|
||
},
|
||
|
||
|
||
},
|
||
};
|
||
|
||
|
||
/**
|
||
* @brief 获取机器人配置参数
|
||
* @return 机器人配置参数指针
|
||
*/
|
||
Config_RobotParam_t* Config_GetRobotParam(void) {
|
||
return &robot_config;
|
||
}
|
||
|