Skip to content

Commit 0f4300e

Browse files
committed
lag better with sp than with measured
1 parent 22e19c7 commit 0f4300e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/base_classes/FOCMotor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ void FOCMotor::loopFOC() {
646646
// calculate the phase voltages
647647
voltage.q = PID_current_q(current_sp - current.q) + feed_forward_voltage.q;
648648
voltage.d = PID_current_d(feed_forward_current.d - current.d) + feed_forward_voltage.d;
649-
// d voltage - lag compensation - TODO verify
650-
if(_isset(phase_inductance_dq.q)) voltage.d = _constrain( voltage.d - current.q*shaft_velocity*pole_pairs*phase_inductance_dq.q, -voltage_limit, voltage_limit);
649+
// d voltage - lag compensation
650+
if(_isset(phase_inductance_dq.q)) voltage.d = _constrain( voltage.d - current_sp*shaft_velocity*pole_pairs*phase_inductance_dq.q, -voltage_limit, voltage_limit);
651651
// q voltage - cross coupling compensation - TODO verify
652652
if(_isset(phase_inductance_dq.d)) voltage.q = _constrain( voltage.q + current.d*shaft_velocity*pole_pairs*phase_inductance_dq.d, -voltage_limit, voltage_limit);
653653
break;

0 commit comments

Comments
 (0)