#include "config.h"
#include "string.h"

#define DEBUG

#define CONFIG_BASE_ADDRESS (ADDR_FLASH_SECTOR_11)

#ifdef DEBUG
Config_Param_t config = {

#else

static const Config_Param_t config = {

#endif


.assemble={ /*assemble_paran_start*/

    .motor_param={   /*motor_param_start*/

.motor_4310_param[0]={
.can=BSP_CAN_2,
.can_id=0x1,
.master_id=0x11,
.module=MOTOR_DM_J4310,
.reverse=false,
},

.motor_4310_param[1]={
.can=BSP_CAN_2, 
.can_id=0x2,
.master_id=0x12,
.module=MOTOR_DM_J4310,
.reverse=false,
},

.motor_4310_param[2]={
.can=BSP_CAN_2,
.can_id=0x3,
.master_id=0x13,
.module=MOTOR_DM_J4310,
.reverse=false,
},

},/*motor_param_end*/

.pid_param={   /*pid_param_start*/

    .assemble_4310_Angle_param[0]={
    .k=5.0f,
    .p=2.0f,
    .i=0.0f,
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 10.0f,
    .d_cutoff_freq =30.0f,
    .range = M_2PI,
    },

    .assemble_4310_Omega_param[0]={
    .k=0.5f,
    .p=0.5f,
    .i=0.0f,    
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 1.0f,
    .d_cutoff_freq =30.0f,
    .range = -1.0f,
    },

    .assemble_4310_Angle_param[1]={
    .k=5.0f,
    .p=2.5f,
    .i=0.0f,
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 10.0f,
    .d_cutoff_freq =30.0f,
    .range = M_2PI,
    },

    .assemble_4310_Omega_param[1]={
    .k=0.5f,
    .p=0.5f,
    .i=0.0f,    
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 1.0f,
    .d_cutoff_freq =30.0f,
    .range = -1.0f,
    },    

    .assemble_4310_Angle_param[2]={
    .k=5.0f,
    .p=2.0f,
    .i=0.0f,
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 10.0f,
    .d_cutoff_freq =30.0f,
    .range = M_2PI,
    },

    .assemble_4310_Omega_param[2]={
    .k=0.5f,
    .p=0.5f,
    .i=0.0f,
    .d=0.0f,
    .i_limit=1.0f,
    .out_limit = 1.0f,
    .d_cutoff_freq =30.0f,
    .range = -1.0f,
    },

},  /*pid_param_end*/

},/*assemble_param_end*/


.chassis={ /*chassis_param_start*/

    .motor_5065_param[0]={
        .can=BSP_CAN_1,
        .id = VESC_1,
        .mode = RPM_CONTROL,
        .reverse = false,
    },
    .motor_5065_param[1]={
        .can=BSP_CAN_1,
        .id = VESC_2,
        .mode = RPM_CONTROL,
        .reverse = false,
    },
    .motor_5065_param[2]={
        .can=BSP_CAN_1,
        .id = VESC_3,
        .mode = RPM_CONTROL,
        .reverse = false,
    },
    .motor_5065_param[3]={
        .can=BSP_CAN_1,
        .id = VESC_4,
        .mode = RPM_CONTROL,
        .reverse = false,
    },
    .motor_6020_param[0]={
        .can=BSP_CAN_2,
        .id = 0x205, /*1*/
        .module = MOTOR_GM6020,
        .reverse = false,
        .gear=false,
    },
    .motor_6020_param[1]={
        .can=BSP_CAN_2,
        .id = 0x206, /*2*/
        .module = MOTOR_GM6020,
        .reverse = false,
        .gear=false,
    },
    .motor_6020_param[2]={
        .can=BSP_CAN_2,
        .id = 0x207, /*3*/
        .module = MOTOR_GM6020,
        .reverse = false,
        .gear=false,
    },
    .motor_6020_param[3]={
        .can=BSP_CAN_2,
        .id = 0x208, /*4*/
        .module = MOTOR_GM6020,
        .reverse = false,
        .gear=false,
    },


    .C6020Angle_param={
        .k=0.3f,
        .p=0.4f,
        .i=0.0f,
        .d=0.0f,
        .i_limit=1.0f,
        .out_limit = 10.0f,
        .d_cutoff_freq =30.0f,
        .range = M_2PI,
    },

    .C6020Omega_param={
        .k=0.3f,
        .p=0.5f,
        .i=0.0f,
        .d=0.0f,
        .i_limit=1.0f,
        .out_limit = 1.0f,
        .d_cutoff_freq =30.0f,
        .range = -1.0f,
    },

    



},/*chassis_param_end*/






};

/**
 * @brief 获取机器人配置参数
 * @return 机器人配置参数指针
 */
Config_Param_t *Config_GetRobotParam(void)
{
    return &config;
}