|
@@ -182,11 +182,11 @@ void mc_conf_default(void) {
|
|
|
conf.m.nor_pll_band = CONFIG_Motor_PLLBand;
|
|
conf.m.nor_pll_band = CONFIG_Motor_PLLBand;
|
|
|
conf.m.epm_pll_band = CONFIG_Motor_EpmPLL;
|
|
conf.m.epm_pll_band = CONFIG_Motor_EpmPLL;
|
|
|
conf.m.pos_pll_band = CONFIG_Motor_PosPLL;
|
|
conf.m.pos_pll_band = CONFIG_Motor_PosPLL;
|
|
|
- conf.m.velocity_w = CONFIG_Motor_VelocityW;
|
|
|
|
|
- conf.m.wheel_c = CONFIG_Motor_VelocityC;
|
|
|
|
|
|
|
+ conf.m.vehicle_w = CONFIG_Motor_VehicleW;
|
|
|
|
|
+ conf.m.wheel_c = CONFIG_Motor_WheelC;
|
|
|
conf.m.gear_ratio = CONFIG_Motor_GearRatio;
|
|
conf.m.gear_ratio = CONFIG_Motor_GearRatio;
|
|
|
conf.m.max_fw_id = CONFIG_Motor_MaxFwDCurr;
|
|
conf.m.max_fw_id = CONFIG_Motor_MaxFwDCurr;
|
|
|
-
|
|
|
|
|
|
|
+ conf.m.max_torque = CONFIG_Motor_MaxTorque;
|
|
|
conf.c.max_dc_vol = CONFIG_Foc_MaxDCVol;
|
|
conf.c.max_dc_vol = CONFIG_Foc_MaxDCVol;
|
|
|
conf.c.min_dc_vol = CONFIG_Foc_MinDCVol;
|
|
conf.c.min_dc_vol = CONFIG_Foc_MinDCVol;
|
|
|
conf.c.max_phase_curr = CONFIG_Foc_MaxPhaseCurr;
|
|
conf.c.max_phase_curr = CONFIG_Foc_MaxPhaseCurr;
|
|
@@ -204,6 +204,7 @@ void mc_conf_default(void) {
|
|
|
conf.c.thro_max_vol = CONFIG_Foc_ThroMaxVol;
|
|
conf.c.thro_max_vol = CONFIG_Foc_ThroMaxVol;
|
|
|
conf.c.thro_min_vol = CONFIG_Foc_ThroMinVol;
|
|
conf.c.thro_min_vol = CONFIG_Foc_ThroMinVol;
|
|
|
conf.c.thro_dec_time = CONFIG_Foc_ThroDecTime;
|
|
conf.c.thro_dec_time = CONFIG_Foc_ThroDecTime;
|
|
|
|
|
+ conf.c.max_autohold_torque = CONFIG_Foc_MaxAutoHoldTorque;
|
|
|
|
|
|
|
|
conf.c.pid[PID_IQ_ID].kp = (float)conf.c.dq_loop_bandwith * 2.0f * 3.14f * conf.m.ld;
|
|
conf.c.pid[PID_IQ_ID].kp = (float)conf.c.dq_loop_bandwith * 2.0f * 3.14f * conf.m.ld;
|
|
|
conf.c.pid[PID_IQ_ID].ki = conf.m.rs / conf.m.ld;
|
|
conf.c.pid[PID_IQ_ID].ki = conf.m.rs / conf.m.ld;
|
|
@@ -283,10 +284,11 @@ int mc_conf_decode_motor(u8 *buff) {
|
|
|
conf.m.nor_pll_band = (float)decode_u16(buff); buff += 2;
|
|
conf.m.nor_pll_band = (float)decode_u16(buff); buff += 2;
|
|
|
conf.m.epm_pll_band = (float)decode_u16(buff); buff += 2;
|
|
conf.m.epm_pll_band = (float)decode_u16(buff); buff += 2;
|
|
|
conf.m.pos_pll_band = (float)decode_u16(buff); buff += 2;
|
|
conf.m.pos_pll_band = (float)decode_u16(buff); buff += 2;
|
|
|
- conf.m.velocity_w = decode_u16(buff);buff += 2;
|
|
|
|
|
|
|
+ conf.m.vehicle_w = decode_u16(buff);buff += 2;
|
|
|
conf.m.wheel_c = decode_u16(buff);buff += 2;
|
|
conf.m.wheel_c = decode_u16(buff);buff += 2;
|
|
|
conf.m.gear_ratio = decode_float(buff);buff += 4;
|
|
conf.m.gear_ratio = decode_float(buff);buff += 4;
|
|
|
conf.m.max_fw_id = decode_u16(buff); buff += 2;
|
|
conf.m.max_fw_id = decode_u16(buff); buff += 2;
|
|
|
|
|
+ conf.m.max_torque = decode_u16(buff); buff += 2;
|
|
|
return buff - ori;
|
|
return buff - ori;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -300,10 +302,11 @@ int mc_conf_encode_motor(u8 *buff) {
|
|
|
encode_u16(buff, (u16)conf.m.nor_pll_band); buff += 2;
|
|
encode_u16(buff, (u16)conf.m.nor_pll_band); buff += 2;
|
|
|
encode_u16(buff, (u16)conf.m.epm_pll_band); buff += 2;
|
|
encode_u16(buff, (u16)conf.m.epm_pll_band); buff += 2;
|
|
|
encode_u16(buff, (u16)conf.m.pos_pll_band); buff += 2;
|
|
encode_u16(buff, (u16)conf.m.pos_pll_band); buff += 2;
|
|
|
- encode_u16(buff, conf.m.velocity_w);buff += 2;
|
|
|
|
|
|
|
+ encode_u16(buff, conf.m.vehicle_w);buff += 2;
|
|
|
encode_u16(buff, conf.m.wheel_c);buff += 2;
|
|
encode_u16(buff, conf.m.wheel_c);buff += 2;
|
|
|
encode_float(buff, conf.m.gear_ratio);buff += 4;
|
|
encode_float(buff, conf.m.gear_ratio);buff += 4;
|
|
|
encode_u16(buff, conf.m.max_fw_id); buff += 2;
|
|
encode_u16(buff, conf.m.max_fw_id); buff += 2;
|
|
|
|
|
+ encode_u16(buff, conf.m.max_torque); buff += 2;
|
|
|
return buff - ori;
|
|
return buff - ori;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -337,6 +340,7 @@ int mc_conf_decode_controler(u8 *buff) {
|
|
|
conf.c.max_epm_back_torque = decode_s16(buff);buff += 2;
|
|
conf.c.max_epm_back_torque = decode_s16(buff);buff += 2;
|
|
|
conf.c.max_ebrk_torque = decode_s16(buff);buff += 2;
|
|
conf.c.max_ebrk_torque = decode_s16(buff);buff += 2;
|
|
|
conf.c.max_idc = decode_s16(buff);buff += 2;
|
|
conf.c.max_idc = decode_s16(buff);buff += 2;
|
|
|
|
|
+ conf.c.max_autohold_torque = decode_s16(buff);buff += 2;
|
|
|
conf.c.dq_loop_bandwith = decode_s16(buff);buff += 2;
|
|
conf.c.dq_loop_bandwith = decode_s16(buff);buff += 2;
|
|
|
conf.c.thro_start_vol = decode_float(buff);buff += 4;
|
|
conf.c.thro_start_vol = decode_float(buff);buff += 4;
|
|
|
conf.c.thro_end_vol = decode_float(buff);buff += 4;
|
|
conf.c.thro_end_vol = decode_float(buff);buff += 4;
|
|
@@ -363,6 +367,7 @@ int mc_conf_encode_controler(u8 *buff) {
|
|
|
encode_s16(buff, conf.c.max_epm_back_torque);buff += 2;
|
|
encode_s16(buff, conf.c.max_epm_back_torque);buff += 2;
|
|
|
encode_s16(buff, conf.c.max_ebrk_torque);buff += 2;
|
|
encode_s16(buff, conf.c.max_ebrk_torque);buff += 2;
|
|
|
encode_s16(buff, conf.c.max_idc);buff += 2;
|
|
encode_s16(buff, conf.c.max_idc);buff += 2;
|
|
|
|
|
+ encode_s16(buff, conf.c.max_autohold_torque);buff += 2;
|
|
|
encode_s16(buff, conf.c.dq_loop_bandwith);buff += 2;
|
|
encode_s16(buff, conf.c.dq_loop_bandwith);buff += 2;
|
|
|
encode_float(buff, conf.c.thro_start_vol);buff += 4;
|
|
encode_float(buff, conf.c.thro_start_vol);buff += 4;
|
|
|
encode_float(buff, conf.c.thro_end_vol);buff += 4;
|
|
encode_float(buff, conf.c.thro_end_vol);buff += 4;
|