190 lines
5.1 KiB
C
190 lines
5.1 KiB
C
/*
|
|
* 配置相关
|
|
*/
|
|
|
|
/* Includes ----------------------------------------------------------------- */
|
|
#include "module/config.h"
|
|
#include "bsp/can.h"
|
|
#include "device/motor_dm.h"
|
|
#include "device/motor_rm.h"
|
|
#include "component/pid.h"
|
|
#include "component/user_math.h"
|
|
#include "device/rc_can.h"
|
|
#include <stdbool.h>
|
|
|
|
/* Private typedef ---------------------------------------------------------- */
|
|
/* Private define ----------------------------------------------------------- */
|
|
/* Private macro ------------------------------------------------------------ */
|
|
/* Private variables -------------------------------------------------------- */
|
|
|
|
/* Exported variables ------------------------------------------------------- */
|
|
|
|
// 机器人参数配置
|
|
Config_RobotParam_t robot_config = {
|
|
.shoot_param = {
|
|
.trig_step_angle=M_2PI/8,
|
|
.shot_delay_time=0.5f,
|
|
.shot_burst_num=20,
|
|
.fric_motor_param[0] = {
|
|
.can = BSP_CAN_2,
|
|
.id = 0x201,
|
|
.module = MOTOR_M3508,
|
|
.reverse = true,
|
|
.gear=false,
|
|
},
|
|
.fric_motor_param[1] = {
|
|
.can = BSP_CAN_2,
|
|
.id = 0x202,
|
|
.module = MOTOR_M3508,
|
|
.reverse = false,
|
|
.gear=false,
|
|
},
|
|
.trig_motor_param = {
|
|
.can = BSP_CAN_1,
|
|
.id = 0x201,
|
|
.module = MOTOR_M2006,
|
|
.reverse = true,
|
|
.gear=true,
|
|
},
|
|
.fric_follow = {
|
|
.k=1.0f,
|
|
.p=1.8f,
|
|
.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,
|
|
},
|
|
|
|
|
|
},
|
|
.gimbal_param = {
|
|
.pid = {
|
|
.yaw_omega = {
|
|
.k = 1.0f,
|
|
.p = 1.0f,
|
|
.i = 0.5f,
|
|
.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 = 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_2,
|
|
.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,
|
|
}
|
|
},
|
|
.rc_can_param = {
|
|
.can = BSP_CAN_1,
|
|
.mode = RC_CAN_MODE_MASTER,
|
|
.joy_id = 0x30,
|
|
.sw_id = 0x31,
|
|
.mouse_id = 0x32,
|
|
.keyboard_id = 0x33,
|
|
},
|
|
};
|
|
|
|
/* Private function prototypes ---------------------------------------------- */
|
|
/* Exported functions ------------------------------------------------------- */
|
|
|
|
/**
|
|
* @brief 获取机器人配置参数
|
|
* @return 机器人配置参数指针
|
|
*/
|
|
Config_RobotParam_t* Config_GetRobotParam(void) {
|
|
return &robot_config;
|
|
} |