Skip to content

Commit af51a85

Browse files
committed
added LPF call for angle and velocity mode
1 parent ba8d8ab commit af51a85

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/HFIBLDCMotor.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ void HFIBLDCMotor::move(float new_target) {
575575
// calculate velocity set point
576576
temp_q_setpoint = feed_forward_velocity + P_angle( shaft_angle_sp - shaft_angle );
577577
temp_q_setpoint = _constrain(temp_q_setpoint,-current_limit, current_limit);
578+
temp_q_setpoint = LPF_angle(temp_q_setpoint);
578579
// calculate the torque command - sensor precision: this calculation is ok, but based on bad value from previous calculation
579580
noInterrupts();
580581
current_setpoint.q = temp_q_setpoint;
@@ -595,6 +596,7 @@ void HFIBLDCMotor::move(float new_target) {
595596
// calculate the torque command
596597
temp_q_setpoint = PID_velocity(shaft_velocity_sp - hfi_velocity); // if current/foc_current torque control
597598
temp_q_setpoint = _constrain(temp_q_setpoint,-current_limit, current_limit);
599+
temp_q_setpoint = LPF_velocity(temp_q_setpoint);
598600
noInterrupts();
599601
current_setpoint.q = temp_q_setpoint;
600602
interrupts();

0 commit comments

Comments
 (0)