add filter to the reported <odrv>.ibus

This commit is contained in:
Samuel Sadok
2020-07-13 16:00:33 +02:00
parent b58d169acc
commit 7fade2b95a
3 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -636,7 +636,7 @@ void update_brake_current() {
// Special handling to avoid the case 0.0/0.0 == NaN.
Ibus_sum += brake_duty ? (brake_duty * vbus_voltage / odrv.config_.brake_resistance) : 0.0f;
ibus_ = Ibus_sum;
ibus_ += odrv.ibus_report_filter_k_ * (Ibus_sum - ibus_);
if (Ibus_sum > odrv.config_.dc_max_positive_current) {
low_level_fault(Motor::ERROR_DC_BUS_OVER_CURRENT);
+1
View File
@@ -239,6 +239,7 @@ public:
float& vbus_voltage_ = ::vbus_voltage; // TODO: make this the actual variable
float& ibus_ = ::ibus_; // TODO: make this the actual variable
float ibus_report_filter_k_ = 1.0f;
const uint64_t& serial_number_ = ::serial_number;
+6
View File
@@ -28,6 +28,12 @@ interfaces:
This value is equal to the sum of the motor currents and the brake resistor currents.
The motor currents are measured, the brake resistor current is calculated based on
`config.brake_resistance`.
ibus_report_filter_k:
type: float32
doc: |
Filter gain for the reported `ibus`. Set to a value below 1.0 to get a smoother
line when plotting `ibus`. Set to 1.0 to disable. This filter is only applied to
the reported value and not for internal calculations.
serial_number: readonly uint64
hw_version_major: readonly uint8
hw_version_minor: readonly uint8