162 lines
6.5 KiB
C
162 lines
6.5 KiB
C
/*
|
||
* 配置相关
|
||
*/
|
||
|
||
/* Includes ----------------------------------------------------------------- */
|
||
#include "module/config.h"
|
||
#include "bsp/can.h"
|
||
#include "device/motor_dm.h"
|
||
|
||
|
||
/* Private typedef ---------------------------------------------------------- */
|
||
/* Private define ----------------------------------------------------------- */
|
||
/* Private macro ------------------------------------------------------------ */
|
||
/* Private variables -------------------------------------------------------- */
|
||
|
||
/* Exported variables ------------------------------------------------------- */
|
||
|
||
// 机器人参数配置
|
||
Config_RobotParam_t robot_config = {
|
||
|
||
.imu_param = {
|
||
.can = BSP_CAN_2,
|
||
.can_id = 0x6FF,
|
||
.device_id = 0x42,
|
||
.master_id = 0x43,
|
||
},
|
||
|
||
.chassis_param = {
|
||
.yaw={
|
||
.k=1.0f,
|
||
.p=1.2f,
|
||
.i=0.0f,
|
||
.d=0.05f,
|
||
.i_limit=0.0f,
|
||
.out_limit=1.0f,
|
||
.d_cutoff_freq=30.0f,
|
||
.range=M_2PI, /* 2*PI,用于处理角度循环误差 */
|
||
},
|
||
|
||
.roll={
|
||
.k=10.0f,
|
||
.p=5.0f, /* 横滚角比例系数 */
|
||
.i=0.0f, /* 横滚角积分系数 */
|
||
.d=0.2f, /* 横滚角微分系数 */
|
||
.i_limit=0.0f, /* 积分限幅 */
|
||
.out_limit=50.0f, /* 输出限幅,腿长差值限制 */
|
||
.d_cutoff_freq=30.0f, /* 微分截止频率 */
|
||
.range=-1.0f, /* 不使用循环误差处理 */
|
||
},
|
||
|
||
.leg_length={
|
||
.k = 40.0f,
|
||
.p = 5.0f,
|
||
.i = 0.0f,
|
||
.d = 1.0f,
|
||
.i_limit = 0.0f,
|
||
.out_limit = 100.0f,
|
||
.d_cutoff_freq = -1.0f,
|
||
.range = -1.0f,
|
||
},
|
||
.leg_theta={
|
||
.k=1.0f,
|
||
.p=5.0f, /* 摆角比例系数 */
|
||
.i=0.0f, /* 摆角积分系数 */
|
||
.d=0.0f, /* 摆角微分系数 */
|
||
.i_limit=0.0f, /* 积分限幅 */
|
||
.out_limit=0.05f, /* 输出限幅,腿长差值限制 */
|
||
.d_cutoff_freq=30.0f, /* 微分截止频率 */
|
||
.range=-1.0f, /* 不使用循环误差处理 */
|
||
},
|
||
|
||
.tp={
|
||
.k=1.0f,
|
||
.p=2.0f, /* 俯仰角比例系数 */
|
||
.i=0.0f, /* 俯仰角积分系数 */
|
||
.d=0.0f, /* 俯仰角微分系数 */
|
||
.i_limit=0.0f, /* 积分限幅 */
|
||
.out_limit=2.0f, /* 输出限幅,腿长差值限制 */
|
||
.d_cutoff_freq=30.0f, /* 微分截止频率 */
|
||
.range=-1.0f, /* 不使用循环误差处理 */
|
||
},
|
||
|
||
|
||
.low_pass_cutoff_freq = {
|
||
.in = 30.0f,
|
||
.out = 30.0f,
|
||
},
|
||
|
||
.yaw_motor = { // 云台Yaw轴电机
|
||
.can = BSP_CAN_2,
|
||
.can_id = 0x1,
|
||
.master_id = 0x11,
|
||
.module = MOTOR_DM_J4310,
|
||
.reverse = false,
|
||
},
|
||
|
||
.mech_zero_yaw = 4.34085676f, /* 250.5度,机械零点 */
|
||
|
||
.vmc_param = {
|
||
{ // 左腿
|
||
.leg_1 = 0.215f, // 后髋连杆长度 (L1) (m)
|
||
.leg_2 = 0.258f, // 后膝连杆长度 (L2) (m)
|
||
.leg_3 = 0.258f, // 前膝连杆长度 (L3) (m)
|
||
.leg_4 = 0.215f, // 前髋连杆长度 (L4) (m)
|
||
.hip_length = 0.0f // 髋宽 (L5) (m)
|
||
},
|
||
{ // 右腿
|
||
.leg_1 = 0.215f, // 后髋连杆长度 (L1) (m)
|
||
.leg_2 = 0.258f, // 后膝连杆长度 (L2) (m)
|
||
.leg_3 = 0.258f, // 前膝连杆长度 (L3) (m)
|
||
.leg_4 = 0.215f, // 前髋连杆长度 (L4) (m)
|
||
.hip_length = 0.0f // 髋宽 (L5) (m)
|
||
}
|
||
},
|
||
.lqr_gains = {
|
||
.k11_coeff = { -1.916376919295156e+02f, 2.009487240966917e+02f, -9.481460086781939e+01f, -4.748704486775178e+00f }, // theta
|
||
.k12_coeff = { -1.794538872095484e+00f, -1.557720009681701e-02f, -7.253705624763870e+00f, -9.066344876912042e-01f }, // d_theta
|
||
.k13_coeff = { -5.530128764310525e+01f, 5.441066051951745e+01f, -1.855725101721958e+01f, -1.532320658646968e+00f }, // x
|
||
.k14_coeff = { -5.226956984912729e+01f, 5.134367619659140e+01f, -1.878250555345751e+01f, -2.194040977657715e+00f }, // d_x
|
||
.k15_coeff = { -8.041587662748894e+00f, 1.194985309170939e+01f, -6.358536570979702e+00f, 8.475914154881636e-01f }, // phi
|
||
.k16_coeff = { -1.171602430557222e+01f, 1.424681188601595e+01f, -6.769563511869035e+00f, 1.358696951640962e+00f }, // d_phi
|
||
.k21_coeff = { -1.589916277171124e+01f, 3.688717311486668e+01f, -2.693106123880470e+01f, 8.468880380216705e+00f }, // theta
|
||
.k22_coeff = { -4.056650578339882e+00f, 5.627051302682392e+00f, -2.802037254431724e+00f, 1.258712322539219e+00f }, // d_theta
|
||
.k23_coeff = { -4.615940205649521e+01f, 5.298830026615487e+01f, -2.321905486010759e+01f, 4.733000143959848e+00f }, // x
|
||
.k24_coeff = { -6.198443605956307e+01f, 6.867018097135634e+01f, -2.873375258895661e+01f, 5.632056979434964e+00f }, // d_x
|
||
.k25_coeff = { -1.149934231218892e+01f, 9.960303123832579e+00f, -2.826210920406189e+00f, 4.384038656352771e+00f }, // phi
|
||
.k26_coeff = { 1.452344963148120e+01f, -1.451377402367933e+01f, 5.020766559053281e+00f, 1.099371055071753e+00f }, // d_phi
|
||
},
|
||
.virtual_chassis_param = {
|
||
.motors = {
|
||
.can = BSP_CAN_1,
|
||
.enable_id = 121,
|
||
.joint_cmd_id = 122,
|
||
.joint_feedback_base_id = 124,
|
||
.wheel_left_id = 0x128,
|
||
.wheel_right_id = 0x129,
|
||
.wheel_left_feedback_id = 0x82,
|
||
.wheel_right_feedback_id = 0x83,
|
||
},
|
||
.imu = {
|
||
.can = BSP_CAN_1,
|
||
.accl_id = 0x301,
|
||
.gyro_id = 0x302,
|
||
.euler_id = 0x303,
|
||
.quat_id = 0x304,
|
||
},
|
||
},
|
||
},
|
||
|
||
|
||
};
|
||
|
||
/* Private function prototypes ---------------------------------------------- */
|
||
/* Exported functions ------------------------------------------------------- */
|
||
|
||
/**
|
||
* @brief 获取机器人配置参数
|
||
* @return 机器人配置参数指针
|
||
*/
|
||
Config_RobotParam_t* Config_GetRobotParam(void) {
|
||
return &robot_config;
|
||
} |