betaflight / blackbox-log-viewer

Interactive log viewer for flight logs recorded with blackbox
GNU General Public License v3.0
449 stars 147 forks source link

Dynamic notch filters on pitch axis are not limited by dynFiltNotchMaxHz #489

Open Ladislawv opened 3 years ago

Ladislawv commented 3 years ago

Describe the bug

There is a problem with dynamic notch filter or in the code that packs data for blackbox logging.

Dynamic notch filters on pitch axis are not limited by dynFiltNotchMaxHz. They are up to 800hz most of the time. On the roll axis everything seems OK.

There's no difference between the latest dev build from yesterday and BF 4.2.5. Tried it on two different quads.

To Reproduce

Set debug mode to FFT_FREQ and check Center Freq [pitch] trace.

Expected behavior

Center freq for pitch axis dynamic filter should be limited by dynFiltNotchMaxHz.

Flight controller configuration

# Betaflight / STM32F411 (S411) 4.2.4 Oct 20 2020 / 08:19:06 (fbcaf8c50) MSP API: 1.43
# config: manufacturer_id: BEFH, board_name: BETAFPVF411, version: 5e160c8b, date: 2019-12-11T10:26:31Z

# start the command batch
batch start

# reset configuration to default settings
defaults nosave

board_name BETAFPVF411
manufacturer_id BEFH
mcu_id 004500653439511437393937
signature 

# name: 95x 

# resources
resource MOTOR 1 B06
resource MOTOR 2 B07
resource MOTOR 3 B04
resource MOTOR 4 B05

# feature
feature -SOFTSERIAL
feature -TELEMETRY
feature -AIRMODE
feature MOTOR_STOP

# beeper
beeper -ARMED

# map
map TAER1234

# serial
serial 0 128 115200 57600 0 2000000
serial 1 64 115200 57600 0 115200

# aux
aux 0 0 0 1300 2100 0 0
aux 1 1 1 1600 2100 0 0
aux 2 13 2 1700 2100 0 0
aux 3 28 0 1650 2100 0 0
aux 4 47 2 1700 2100 0 0

# master
set gyro_lowpass_hz = 0
set gyro_lowpass2_hz = 1000
set dyn_notch_width_percent = 0
set dyn_notch_q = 240
set dyn_notch_min_hz = 90
set dyn_notch_max_hz = 350
set dyn_lpf_gyro_min_hz = 0
set dyn_lpf_gyro_max_hz = 1000
set gyro_filter_debug_axis = PITCH
set acc_calibration = -63,222,80,1
set rssi_channel = 16
set rc_interp = MANUAL
set rc_interp_int = 6
set rc_smoothing_input_hz = 30
set rc_smoothing_derivative_hz = 30
set rc_smoothing_derivative_type = BIQUAD
set fpv_mix_degrees = 20
set serialrx_provider = CRSF
set blackbox_mode = MOTOR_TEST
set dshot_idle_value = 550
set dshot_bidir = ON
set motor_poles = 12
set failsafe_delay = 20
set align_board_roll = 180
set align_board_yaw = -90
set bat_capacity = 380
set vbat_max_cell_voltage = 437
set vbat_warning_cell_voltage = 345
set use_cbat_alerts = ON
set cbat_alert_percent = 1
set ibata_scale = 580
set ibata_offset = 100
set yaw_motors_reversed = ON
set small_angle = 180
set gps_auto_baud = ON
set gps_set_home_point_once = ON
set osd_warn_rssi = ON
set osd_warn_over_cap = ON
set osd_rssi_alarm = 10
set osd_cap_alarm = 250
set osd_tim1 = 2561
set osd_rssi_pos = 14377
set osd_link_quality_pos = 14477
set osd_rssi_dbm_pos = 14509
set osd_tim_1_pos = 6199
set osd_remaining_time_estimate_pos = 2391
set osd_throttle_pos = 2104
set osd_current_pos = 6476
set osd_mah_drawn_pos = 14538
set osd_motor_diag_pos = 418
set osd_power_pos = 2084
set osd_warnings_pos = 14602
set osd_avg_cell_voltage_pos = 14543
set osd_battery_usage_pos = 2088
set osd_disarmed_pos = 14571
set osd_adjustment_range_pos = 2402
set osd_profile = 2
set debug_mode = FFT_FREQ
set gyro_1_sensor_align = DEFAULT
set name = 95x 

profile 0

# profile 0
set dyn_lpf_dterm_min_hz = 140
set dyn_lpf_dterm_max_hz = 340
set dyn_lpf_dterm_curve_expo = 7
set dterm_lowpass_hz = 100
set dterm_lowpass2_hz = 300
set feedforward_transition = 4
set iterm_relax = RPY
set iterm_relax_cutoff = 10
set iterm_windup = 70
set pidsum_limit = 1000
set pidsum_limit_yaw = 1000
set throttle_boost = 0
set throttle_boost_cutoff = 25
set p_pitch = 74
set i_pitch = 60
set d_pitch = 40
set f_pitch = 0
set p_roll = 76
set i_roll = 60
set d_roll = 40
set f_roll = 0
set p_yaw = 50
set i_yaw = 100
set f_yaw = 0
set angle_level_strength = 150
set horizon_level_strength = 100
set d_min_roll = 0
set d_min_pitch = 0
set d_min_boost_gain = 45
set d_min_advance = 45
set ff_interpolate_sp = AVERAGED_3
set ff_spike_limit = 55
set ff_smooth_factor = 40
set ff_boost = 0

profile 1

# profile 1
set dyn_lpf_dterm_min_hz = 140
set dyn_lpf_dterm_max_hz = 340
set dyn_lpf_dterm_curve_expo = 7
set dterm_lowpass_hz = 100
set dterm_lowpass2_hz = 300
set feedforward_transition = 1
set iterm_relax = RPY
set iterm_relax_cutoff = 10
set iterm_windup = 70
set pidsum_limit = 1000
set pidsum_limit_yaw = 1000
set throttle_boost = 0
set throttle_boost_cutoff = 25
set p_pitch = 95
set i_pitch = 60
set d_pitch = 50
set f_pitch = 0
set p_roll = 105
set i_roll = 60
set d_roll = 55
set f_roll = 0
set p_yaw = 50
set i_yaw = 100
set f_yaw = 0
set angle_level_strength = 150
set horizon_level_strength = 100
set d_min_roll = 0
set d_min_pitch = 0
set d_min_boost_gain = 45
set d_min_advance = 45
set ff_interpolate_sp = AVERAGED_3
set ff_spike_limit = 55
set ff_smooth_factor = 40
set ff_boost = 0

profile 2

# profile 2
set dyn_lpf_dterm_min_hz = 140
set dyn_lpf_dterm_max_hz = 340
set dyn_lpf_dterm_curve_expo = 7
set dterm_lowpass_hz = 100
set dterm_lowpass2_hz = 300
set feedforward_transition = 4
set iterm_relax = RPY
set iterm_relax_cutoff = 10
set iterm_windup = 70
set pidsum_limit = 1000
set pidsum_limit_yaw = 1000
set throttle_boost = 0
set throttle_boost_cutoff = 25
set p_pitch = 85
set i_pitch = 60
set d_pitch = 45
set f_pitch = 0
set p_roll = 85
set i_roll = 60
set d_roll = 45
set f_roll = 0
set p_yaw = 100
set i_yaw = 100
set f_yaw = 0
set angle_level_strength = 150
set horizon_level_strength = 100
set d_min_roll = 0
set d_min_pitch = 0
set d_min_boost_gain = 45
set d_min_advance = 45
set ff_interpolate_sp = AVERAGED_3
set ff_spike_limit = 55
set ff_smooth_factor = 40
set ff_boost = 0

# restore original profile selection
profile 1

rateprofile 0

# rateprofile 0
set roll_srate = 75
set pitch_srate = 75
set yaw_srate = 75

rateprofile 1

# rateprofile 1
set yaw_rc_rate = 200
set roll_srate = 75
set pitch_srate = 75
set yaw_srate = 50
set tpa_rate = 75

rateprofile 2

# rateprofile 2
set rates_type = ACTUAL
set roll_rc_rate = 1
set pitch_rc_rate = 1
set yaw_rc_rate = 1
set roll_srate = 80
set pitch_srate = 80
set yaw_srate = 80

rateprofile 3

# rateprofile 3
set rates_type = ACTUAL
set roll_rc_rate = 1
set pitch_rc_rate = 1
set yaw_rc_rate = 36
set roll_srate = 80
set pitch_srate = 80
set yaw_srate = 80

rateprofile 4

# rateprofile 4
set roll_rc_rate = 140
set pitch_rc_rate = 140
set yaw_rc_rate = 140
set roll_srate = 65
set pitch_srate = 65
set yaw_srate = 65
set tpa_rate = 75

rateprofile 5

# rateprofile 5
set roll_rc_rate = 200
set pitch_rc_rate = 200
set yaw_rc_rate = 200
set roll_srate = 50
set pitch_srate = 50
set yaw_srate = 50
set tpa_rate = 75

# restore original rateprofile selection
rateprofile 0
A00: FLASH_CS
A01: GYRO_EXTI
A02: SERIAL_TX 2
A03: SERIAL_RX 2
A04: GYRO_CS 1
A05: SPI_SCK 1
A06: SPI_MISO 1
A07: SPI_MOSI 1
A08: FREE
A09: FREE
A10: FREE
A11: USB
A12: USB
A13: SWD
A14: SWD
A15: FREE
B00: ADC_BATT
B01: ADC_CURR
B02: BEEPER
B03: FREE
B04: MOTOR 3
B05: MOTOR 4
B06: MOTOR 1
B07: MOTOR 2
B08: I2C_SCL 1
B09: I2C_SDA 1
B10: FREE
B11: FREE
B12: OSD_CS
B13: SPI_SCK 2
B14: SPI_MISO 2
B15: SPI_MOSI 2
C00: FREE
C01: FREE
C02: FREE
C03: FREE
C04: FREE
C05: FREE
C06: FREE
C07: FREE
C08: FREE
C09: FREE
C10: FREE
C11: FREE
C12: FREE
C13: LED 1
C14: LED 2
C15: FREE
D00: FREE
D01: FREE
D02: FREE
D03: FREE
D04: FREE
D05: FREE
D06: FREE
D07: FREE
D08: FREE
D09: FREE
D10: FREE
D11: FREE
D12: FREE
D13: FREE
D14: FREE
D15: FREE
E00: FREE
E01: FREE
E02: FREE
E03: FREE
E04: FREE
E05: FREE
E06: FREE
E07: FREE
E08: FREE
E09: FREE
E10: FREE
E11: FREE
E12: FREE
E13: FREE
E14: FREE
E15: FREE

Currently active Timers:
-----------------------
TIM1: FREE
TIM2: FREE
TIM3:
    CH1: MOTOR 3
    CH2: MOTOR 4
TIM4:
    CH1: MOTOR 1
    CH2: MOTOR 2
TIM5: FREE
TIM6: FREE
TIM7: FREE
TIM9: FREE
TIM10: FREE
TIM11: FREE

Currently active DMA:
--------------------
DMA1 Stream 0: MOTOR 1
DMA1 Stream 1: FREE
DMA1 Stream 2: FREE
DMA1 Stream 3: MOTOR 2
DMA1 Stream 4: MOTOR 3
DMA1 Stream 5: MOTOR 4
DMA1 Stream 6: FREE
DMA1 Stream 7: FREE
DMA2 Stream 0: ADC 1
DMA2 Stream 1: FREE
DMA2 Stream 2: FREE
DMA2 Stream 3: FREE
DMA2 Stream 4: FREE
DMA2 Stream 5: FREE
DMA2 Stream 6: FREE
DMA2 Stream 7: FREE

Setup / Versions

FFT_FREQ

Here are the logs: dyn_pitch_axis.zip

etracer65 commented 3 years ago

This is simply a case of the debug element labels in the blackbox viewer not being updated to match the information actually written to the log in the firmware. At some point the logging changed int eh firmware and the blackbox viewer was not updated to reflect the new contents.

Moving to the blackbox viewer repo.