-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
[DO NOT MERGE] initial SPI DMA IMU driver (mpu9250) for testing/review/discussion #10602
Conversation
4c3b186
to
3cddd01
Compare
Awesome! Great to see progress on this. I see that the filter is applied to the downsampled 1kHz signal. I think it should be done on the raw signal though (at least for the control path). @dakejahl do you have a log (with high-rate logging)? |
Heres a log: https://review.px4.io/plot_app?log=06a7a485-5c02-4d97-9bf8-eb05f7569004 It's not high rate. Even with high rate logging the logger only can run at ~250hz. Anything we can do to increase this? As you can see in this log there's still some work to do to clean up the data. |
You can reduce the log interval here: https://github.com/PX4/Firmware/blob/master/src/modules/logger/logger.cpp#L283. |
This is running a filter over the raw data before down sampling to 1khz. Floating point math :(
Heres a log of a flight with this code: https://review.px4.io/plot_app?log=282df03c-b320-45a9-8dad-952381b05054 It actually flies! Clearly I needed to filter before downsampling, thanks @bkueng! Next step is to optimize the filter code. |
Are you adding filtering to the estimator path? |
@mhkabir yes, see |
This is the design we're working towards while at the same time trying to push all common accel/gyro/mag logic in reusable classes. Ideally this would allow us to move over all the existing IMU drivers, then split sensor_gyro without having to touch every single driver. The prefiltering should be dropped and we need to look at structuring this such that the integration (estimator path) and filtering (control path) are performed on the raw data (separately). |
213e050
to
4ecf1d1
Compare
How do we push the raw data to the rest of the system when we are collecting multiple measurements per cycle inside of the driver? |
eb2184c
to
a513d07
Compare
Updated to latest PX4/NuttX#25 and Firmware master. |
a513d07
to
dc4a1a3
Compare
…out the device ID and how best to handle calibration
… more testing + clean up + a good review
…p command in rc.sensors
…lly bad noise on the gyro.
dc4a1a3
to
985f645
Compare
TODO: review NuttX CONFIG_SPI_TRIGGER and HWFEAT_TRIGGER Followup - https://groups.google.com/forum/#!topic/nuttx/4EE8xx-oIGY |
…es supported by SPI. It now supports a deffered DMA trigger hardware configuration. arch/arm/src/stm32/stm32_spi.c: Implements the new deferred DMA trigger feature.
NuttX changes to configure DMA per SPI for both stm32 and stm32f7 have been upstreamed. |
The NuttX 7.28 update has been merged to master giving us the capability to configure DMA per SPI separately. After the new work queue (#11261) goes in we can start enabling SPI DMA. |
Project board for the larger effort: https://github.com/PX4/Firmware/projects/23
This is an initial prototype mpu9250 driver using SPI DMA on NuttX reading all raw data from the sensor. There's still quite a lot to do before this will be ready for PX4 master, but it should be mostly working on a pixracer (at least for bench testing).
The mpu9250 accel and gyro are read at 4 kHz. In an mpu6500 (or mpu9250 ignoring mag) all 32 kHz of raw gyro data is transferred.
TODO
read fifo_count
follow byread fifo
. If something preempts between those operations I can get an overflow without knowing it. I'll confirm or deny this Monday.