flight_review icon indicating copy to clipboard operation
flight_review copied to clipboard

feat: added FFT plots for accelerometer, gyro and rate setpoints

Open francelico opened this issue 4 years ago • 8 comments

Added new FFT plots for the accelerometer and gyro raw data in order to better visualise the effect of notch and lowpass filters.

bokeh_plot

bokeh_plot(1)

Also added a FFT for the rate setpoints data. Not convinced of its utility yet, the reasoning was to provide additional insights of the outputs of the rate controller.

bokeh_plot(2)

In the future I would like to also have a Dterm FFT plot but that will require a PR to have it logged in the main stack.

francelico avatar Jun 06 '20 12:06 francelico

In the future I would like to also have a Dterm FFT plot but that will require a PR to have it logged in the main stack.

In current PX4 we have vehicle_angular_acceleration computed and filtered upstream of the controller.

dagar avatar Jun 06 '20 13:06 dagar

bokeh_plot(1)

Overlaying the gyro filter parameters on the accelerometer FFT is a bit distracting.

dagar avatar Jun 07 '20 16:06 dagar

Would it be interesting to plot the FFT for some of these topics before and after filtering?

dagar avatar Jun 07 '20 17:06 dagar

  • I'd rather use the FIFO topics to show unfiltered FFT's. That gives much higher frequencies and is already there: https://github.com/PX4/flight_review/blob/724102d869e95c4538afcc169333ef41886c7b0e/plot_app/configured_plots.py#L629.
  • I think a separate FFT for the D-term is useful

bkueng avatar Jun 08 '20 08:06 bkueng

bokeh_plot(1)

Overlaying the gyro filter parameters on the accelerometer FFT is a bit distracting.

Good point, will fix this.

francelico avatar Jun 08 '20 10:06 francelico

Would it be interesting to plot the FFT for some of these topics before and after filtering?

Agreed to have both raw and filtered data, would be really helpful for filters tuning. However we are in a weird situation where the filtering is not happening in the same place in stable and master at the moment.

From my understanding: Differences between v1.10.1 (stable) and master:

  • On stable, the gyro and accelerometer filtering is driver level.
  • On master, all filtering is happening in VehicleAcceleration.cpp (accel) and VehicleAngularVelocity.cpp (gyro and Dterm).

In this PR the log is showing the sensors_combined data, which means it would show the filtered data in stable and the unfiltered data in master. Should we wait for v.1.11 stable release to unify things?

Concerning the Dterm:

  • On stable, Dterm filtering is happening inside attitude controller.
  • On master, all filtering is happening in VehicleAcceleration.cpp (accel) and VehicleAngularVelocity.cpp (gyro and Dterm).

so making FFT of vehicle_angular_acceleration output would show the filtered data on master, and the unfiltered data on stable. v1.11 stable should also unify things there.

francelico avatar Jun 08 '20 11:06 francelico

* I'd rather use the FIFO topics to show unfiltered FFT's. That gives much higher frequencies and is already there: https://github.com/PX4/flight_review/blob/724102d869e95c4538afcc169333ef41886c7b0e/plot_app/configured_plots.py#L629
  .

* I think a separate FFT for the D-term is useful

It would be great to use FIFO for raw data @bkueng , as I understand we would have much higher sampling rate? The FFT would then provide much more info (see https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem ). The FIFO plots don't appear when I run the stable release on fmuv5 (CUAV nano). I tried looking into past PRs to see the state of things but couldn't find clear info. What is the state of FIFO in stable/master/v1.11 upcoming release for the fmuv5 boards? Do you need to enable it manually on stable?

francelico avatar Jun 08 '20 11:06 francelico

You'll have to use master for the fifo topics, and add them to the log - it's a bit more involved as logging rate becomes exceedingly high, and I'll have to do some changes to the logger to make it generally usable. As we have an upcoming release, we can make sure everything works against master, the previous release is just too different.

bkueng avatar Jun 08 '20 11:06 bkueng