Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

francelico
Copy link

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.

@dagar
Copy link
Member

dagar commented Jun 6, 2020

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
Copy link
Member

dagar commented Jun 7, 2020

bokeh_plot(1)

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

@dagar
Copy link
Member

dagar commented Jun 7, 2020

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

@bkueng
Copy link
Member

bkueng commented Jun 8, 2020

  • I'd rather use the FIFO topics to show unfiltered FFT's. That gives much higher frequencies and is already there:
    if add_virtual_fifo_topic_data(ulog, 'sensor_gyro_fifo'):
    .
  • I think a separate FFT for the D-term is useful

@francelico
Copy link
Author

bokeh_plot(1)

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

Good point, will fix this.

@francelico
Copy link
Author

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
Copy link
Author

* 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?

@bkueng
Copy link
Member

bkueng commented Jun 8, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants