File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments