/* * 配置相关 */ /* Includes ----------------------------------------------------------------- */ #include "module/config.h" #include /* Private typedef ---------------------------------------------------------- */ /* Private define ----------------------------------------------------------- */ /* Private macro ------------------------------------------------------------ */ /* Private variables -------------------------------------------------------- */ /* Exported variables ------------------------------------------------------- */ /** * @brief 机器人参数配置 * @note 在此配置机器人参数 */ Config_RobotParam_t robot_config = { /* USER CODE BEGIN robot_config */ .gimbal_param = { .pid = { .yaw_omega = { .k = 1.0f, .p = 1.0f, .i = 0.3f, .d = 0.0f, .i_limit = 1.0f, .out_limit = 1.0f, .d_cutoff_freq = -1.0f, .range = -1.0f, }, .yaw_angle = { .k = 8.0f, .p = 3.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.0f, .i_limit = 1.0f, .out_limit = 1.0f, .d_cutoff_freq = -1.0f, .range = -1.0f, }, .pit_angle = { .k = 5.0f, .p = 5.0f, .i = 2.5f, .d = 0.0f, .i_limit = 0.0f, .out_limit = 10.0f, .d_cutoff_freq = -1.0f, .range = M_2PI, }, }, .mech_zero = { .yaw = 0.0f, .pit = 1.77f, }, .travel = { .yaw = -1.0f, .pit = 0.8f, }, .low_pass_cutoff_freq = { .out = -1.0f, .gyro = 1000.0f, }, .pit_motor ={ .can = BSP_CAN_1, .id = 0x206, .gear = false, .module = MOTOR_GM6020, .reverse = true, }, .yaw_motor = { .can = BSP_CAN_1, .can_id = 0x1, .master_id = 0x11, .module = MOTOR_DM_J4310, .reverse = false, }, .imu = { .can = BSP_CAN_2, .accl_id = 0x64, // 100 .gyro_id = 0x65, // 101 .eulr_id = 0x66, // 102 .quat_id = 0x67 // 103 }, }, .shoot_param = { .trig_step_angle=M_2PI/8, .shot_delay_time=1.0f, .shot_burst_num=20, .fric_motor_param[0] = { .can = BSP_CAN_1, .id = 0x201, .module = MOTOR_M3508, .reverse = false, .gear=false, }, .fric_motor_param[1] = { .can = BSP_CAN_1, .id = 0x202, .module = MOTOR_M3508, .reverse = true, .gear=false, }, .trig_motor_param = { .can = BSP_CAN_1, .id = 0x203, .module = MOTOR_M2006, .reverse = true, .gear=true, }, .fric_follow = { .k=1.0f, .p=1.5f, .i=0.0f, .d=0.0f, .i_limit=0.0f, .out_limit=0.9f, .d_cutoff_freq=30.0f, .range=-1.0f, }, .fric_err = { .k=1.0f, .p=4.0f, .i=0.4f, .d=0.04f, .i_limit=0.25f, .out_limit=0.25f, .d_cutoff_freq=40.0f, .range=-1.0f, }, .trig_omg = { .k=1.0f, .p=1.5f, .i=0.3f, .d=0.5f, .i_limit=0.2f, .out_limit=0.9f, .d_cutoff_freq=-1.0f, .range=-1.0f, }, .trig = { .k=1.0f, .p=1.0f, .i=0.1f, .d=0.05f, .i_limit=0.8f, .out_limit=0.5f, .d_cutoff_freq=-1.0f, .range=M_2PI, }, .filter.fric = { .in = 30.0f, .out = 30.0f, }, .filter.trig = { .in = 30.0f, .out = 30.0f, }, }, .chassis_param = { .yaw={ .k=0.0f, .p=1.0f, .i=0.0f, .d=0.3f, .i_limit=0.0f, .out_limit=1.0f, .d_cutoff_freq=30.0f, .range=M_2PI, /* 2*PI,用于处理角度循环误差 */ }, .roll={ .k=0.2f, .p=0.5f, /* 横滚角比例系数 */ .i=0.01f, /* 横滚角积分系数 */ .d=0.01f, /* 横滚角微分系数 */ .i_limit=0.2f, /* 积分限幅 */ .out_limit=1.0f, /* 输出限幅,腿长差值限制 */ .d_cutoff_freq=30.0f, /* 微分截止频率 */ .range=-1.0f, /* 不使用循环误差处理 */ }, .leg_length={ .k = 40.0f, .p = 20.0f, .i = 0.01f, .d = 2.0f, .i_limit = 0.0f, .out_limit = 200.0f, .d_cutoff_freq = -1.0f, .range = -1.0f, }, .leg_theta={ .k=5.0f, .p=2.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=4.0f, .p=3.0f, /* 俯仰角比例系数 */ .i=0.0f, /* 俯仰角积分系数 */ .d=0.0f, /* 俯仰角微分系数 */ .i_limit=0.0f, /* 积分限幅 */ .out_limit=10.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_1, .can_id = 0x1, .master_id = 0x11, .module = MOTOR_DM_J4310, .reverse = false, }, .joint_param = { { // 左髋关节 .can = BSP_CAN_3, .motor_id = 124, .host_id = 0xFF, .module = MOTOR_LZ_RSO3, .reverse = false, .mode = MOTOR_LZ_MODE_MOTION, }, { // 右髋关节 .can = BSP_CAN_3, .motor_id = 125, .host_id = 0xFF, .module = MOTOR_LZ_RSO3, .reverse = false, .mode = MOTOR_LZ_MODE_MOTION, }, { // 左膝关节 .can = BSP_CAN_3, .motor_id = 126, .host_id = 0xFF, .module = MOTOR_LZ_RSO3, .reverse = true, .mode = MOTOR_LZ_MODE_MOTION, }, { // 右膝关节 .can = BSP_CAN_3, .motor_id = 127, .host_id = 0xFF, .module = MOTOR_LZ_RSO3, .reverse = true, .mode = MOTOR_LZ_MODE_MOTION, }, }, .wheel_param = { { // 左轮电机 .can = BSP_CAN_3, .id = 0x142, .module = MOTOR_LK_MF9025, .reverse = false, }, { // 右轮电机 .can = BSP_CAN_3, .id = 0x141, .module = MOTOR_LK_MF9025, .reverse = true, }, }, .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 = { -2.111003343424443e+02f, 2.534552823281283e+02f, -1.288428090302336e+02f, -4.837794661314790e-01f }, // theta .k12_coeff = { 9.842131763802227e+00f, -7.572331320496771e+00f, -6.747008033464407e+00f, 2.794374462854655e-02f }, // d_theta .k13_coeff = { -7.026854551050478e+01f, 7.582881862804882e+01f, -2.920474536554779e+01f, 1.123343465922494e+00f }, // x .k14_coeff = { -7.955300118741869e+01f, 8.683186601398823e+01f, -3.503519879783562e+01f, 1.204200953017506e+00f }, // d_x .k15_coeff = { 2.214748921482655e+01f, -5.719424594843836e+00f, -8.215498046486028e+00f, 3.357225411090161e+00f }, // phi .k16_coeff = { -2.588732118811617e-01f, 3.189187555191166e+00f, -3.235989186139448e+00f, 9.848256812196189e-01f }, // d_phi .k21_coeff = { 3.783375900877637e+02f, -3.033633007638497e+02f, 4.903946574528503e+01f, 1.550109363173939e+01f }, // theta .k22_coeff = { 2.878430656512739e+01f, -2.993892895824752e+01f, 1.019545567095573e+01f, 1.119137437173934e+00f }, // d_theta .k23_coeff = { 2.518975783541210e+01f, 2.088553619504979e+00f, -1.929185285401291e+01f, 8.558202445583612e+00f }, // x .k24_coeff = { 2.519335578848752e+01f, 5.878465085842500e+00f, -2.359290011046876e+01f, 1.050067818606354e+01f }, // d_x .k25_coeff = { 1.146427691025439e+02f, -1.303101485018965e+02f, 5.234994297700838e+01f, 1.889931627651257e+00f }, // phi .k26_coeff = { 3.214791991578748e+01f, -3.467989029865478e+01f, 1.318125503363052e+01f, -3.471228203459202e-01f }, // d_phi }, .theta = 0.0f, .x = 0.0f, .phi = -0.1f, } /* USER CODE END robot_config */ }; /* Private function prototypes ---------------------------------------------- */ /* Exported functions ------------------------------------------------------- */ /** * @brief 获取机器人配置参数 * @return 机器人配置参数指针 */ Config_RobotParam_t* Config_GetRobotParam(void) { return &robot_config; }