-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Drivers Code Cleanup #9279
Comments
There's quite a lot that could be discussed here. For me the worst part is that most of the drivers appear to have been developed largely by copy and paste. New drivers are added by duplicating something close, then making a few changes. Huge portions of near boilerplate code are duplicated multiple times. This has resulted in a large sprawling code base that's difficult to maintain and uses significantly more flash than is necessary. As an illustration here's a relatively simple pull request that changed the way raw/unfiltered IMU was published. #8517 |
I agree with the comments above. |
@thomasgubler , @dagar , We are working on a basic driver parent class to begin unifying driver construction and are interested in your input. Recent work on the lis3mdl driver and current work on the batt_smbus and mpu9250 driver represents some of the structure we have implemented, however, there might still be better architectures we haven't identified. If you have opinions you would like to see implemented please let me know. -Mark |
I'm excited to see interest here. From a code maintenance, platform scalability, and developer sanity standpoint I think abstracting the common pieces of each driver type is long overdue. As a start take a look at the Airspeed class used by all differential pressure sensor drivers. https://github.com/PX4/Firmware/tree/master/src/lib/drivers/airspeed As much as I love to eliminate code bloat and make things as simple as possible, the most valuable changes we need really are in the sensor pipeline. In terms of system capabilities I view this as an opportunity to implement some of the core improvements that are particularly important for racers and system integrators right now. The most important is splitting the IMU drivers into a high rate publication path to the rate controller (400 Hz - 2 kHz), and a separate delta angle and delta velocity publication (250 Hz) for the EKF. We also need to increase the sampling rate as much as possible (>= 4 kHz) and do all of the filtering PX4 side to help with aliasing and clipping. This will require getting the drivers out of ISRs and enabling SPI DMA. Notes
Relevant issues/PRs |
Believe it or not nearly all of this has been done. |
Goals:
The text was updated successfully, but these errors were encountered: