Skip to content

Commit d6b33f4

Browse files
committed
FIX set voltage d to 0 when in torque mode
1 parent b860f4d commit d6b33f4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/BLDCMotor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,13 @@ void BLDCMotor::move(float new_target) {
313313

314314
switch (controller) {
315315
case MotionControlType::torque:
316-
if(torque_controller == TorqueControlType::voltage) // if voltage torque control
316+
if(torque_controller == TorqueControlType::voltage){ // if voltage torque control
317317
if(!_isset(phase_resistance)) voltage.q = target;
318318
else voltage.q = target*phase_resistance;
319-
else
319+
voltage.d = 0;
320+
}else{
320321
current_sp = target; // if current/foc_current torque control
322+
}
321323
break;
322324
case MotionControlType::angle:
323325
// angle set point

0 commit comments

Comments
 (0)