change current lim tolerance to absolute margin

This commit is contained in:
Oskar Weigl
2019-10-28 20:34:17 -07:00
parent 6fd84d48d6
commit cbae7c5b85
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -360,7 +360,7 @@ bool Motor::FOC_current(float Id_des, float Iq_des, float I_phase, float pwm_pha
ictrl.Id_measured += ictrl.I_measured_report_filter_k * (Id - ictrl.Id_measured);
// Check for violation of current limit
float I_trip = config_.current_lim_tolerance * effective_current_lim();
float I_trip = effective_current_lim() * config_.current_lim_margin;
if (SQ(Id) + SQ(Iq) > SQ(I_trip)) {
set_error(ERROR_CURRENT_LIMIT_VIOLATION);
return false;