162 lines
6.3 KiB
C
162 lines
6.3 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 = 20.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.971875171647865e+02f, 2.333085109680034e+02f, -1.246153590631013e+02f, -1.174312882115276e+00f }, // theta
|
||
.k12_coeff = { 1.013831636839851e+01f, -9.401172931240684e+00f, -7.093019361028483e+00f, -1.965070661986029e-01f }, // d_theta
|
||
.k13_coeff = { -8.071626496047382e+01f, 8.488840381053994e+01f, -3.185529183755884e+01f, 8.124359207371032e-01f }, // x
|
||
.k14_coeff = { -9.146471594077464e+01f, 9.719345618895781e+01f, -3.842805305561099e+01f, 7.255654659220748e-01f }, // d_x
|
||
.k15_coeff = { 6.971426904628133e+00f, 1.184154915473761e+00f, -5.491870448330107e+00f, 1.440694962464955e+00f }, // phi
|
||
.k16_coeff = { -1.435148366342453e+00f, 3.514683607111185e+00f, -2.799267599341074e+00f, 7.265018312372623e-01f }, // d_phi
|
||
.k21_coeff = { 2.190542850560747e+02f, -1.777611537012371e+02f, 2.829510877414540e+01f, 1.179295840423852e+01f }, // theta
|
||
.k22_coeff = { 1.499600560463937e+01f, -1.645293844666804e+01f, 6.159388841822305e+00f, 1.123989134168646e+00f }, // d_theta
|
||
.k23_coeff = { -2.101291454047308e+00f, 2.194459164295155e+01f, -2.170715123911771e+01f, 7.721879713384771e+00f }, // x
|
||
.k24_coeff = { -8.999340091522836e+00f, 3.152322448910924e+01f, -2.733558805289098e+01f, 9.654200348790059e+00f }, // d_x
|
||
.k25_coeff = { 2.294462014541718e+01f, -2.777789794229430e+01f, 1.160794075992378e+01f, 2.826138680231716e+00f }, // phi
|
||
.k26_coeff = { 1.624214174273862e+01f, -1.723094946447953e+01f, 6.402650924792812e+00f, 8.755827436652930e-02f }, // 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;
|
||
} |