Skip to content

Commit dfe4222

Browse files
committed
current sense filtering #102 in monitor
1 parent 6053c1c commit dfe4222

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/common/base_classes/FOCMotor.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,19 @@ void FOCMotor::monitor() {
108108
DQCurrent_s c{0,0};
109109
if(current_sense){
110110
if(torque_controller == TorqueControlType::foc_current) c = current;
111-
else c = current_sense->getFOCCurrents(electrical_angle);
111+
else{
112+
c = current_sense->getFOCCurrents(electrical_angle);
113+
c.q = LPF_current_q(c.q);
114+
c.d = LPF_current_d(c.d);
115+
}
112116
}
113117
if(monitor_variables & _MON_CURR_Q) {
114-
monitor_port->print(c.q*1000,2); // mAmps
118+
monitor_port->print(c.q*1000, 2); // mAmps
115119
monitor_port->print("\t");
116120
printed= true;
117121
}
118122
if(monitor_variables & _MON_CURR_D) {
119-
monitor_port->print(c.d*1000,2); // mAmps
123+
monitor_port->print(c.d*1000, 2); // mAmps
120124
monitor_port->print("\t");
121125
printed= true;
122126
}

0 commit comments

Comments
 (0)