-
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
PX4 general work queue and move all drivers to new work queue #11571
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll probably have to trust you and the compiler on this one, right?
I'd do a direct comparison with a platform you have on hand. Make sure all the drivers and running and providing sane data at the expected publication rate. Once we're closer I'll expand that testing and log review across a wider range of boards. I intentionally tried to keep it close to the original usage so we could make the change safely and easily. Any driver that wasn't using the same basic HPWORK/LPWORK pattern was skipped in this pass. |
Ok will do. |
ee35dde
to
6fee1b8
Compare
Tested on px4_fmu-v4 and px4_fmu-v5. |
1bc2527
to
990d8a0
Compare
990d8a0
to
ac6c467
Compare
541b400
to
3c49eae
Compare
8652ddb
to
6814da7
Compare
6814da7
to
4163720
Compare
1848651
to
8334f7d
Compare
cc7276d
to
c46f946
Compare
Let's finally get this in and start pushing on the other fundamental driver improvements that build on it (eg IMU full raw sampling with FIFOs and SPI DMA). |
Continuation of #11261.
This pull request migrates nearly all drivers to the new PX4 work queue (#11570). This includes drivers running out of hrt callbacks, or NuttX HPWORK/LPWORK.
Continuation of #11261.
More background to come, but in short this general px4 work queue will allow us to finally unblock several important things.
Closes #8814
Design Notes
Each PX4 module that previously used hrt_calls, HPWORK, or LPWORK can now easily be moved into this framework. These classes inherit either WorkItem to be run as needed, or ScheduledWorkItem if a fixed interval is desired.
The reason for the (somewhat awkward) WorkQueueManager is to get every queue (a pthread) running within the same task group on NuttX. This significantly reduces overhead, and when combined with uORB changes (#11176) has no disadvantages. The cost of each work queue is little more than the stack (1-2 kB).
The other option for scheduling WorkItems is something I've bolted into uORB itself. The common pattern throughout most important PX4 modules is a task that polls a uORB topic for updates. Many of these processes are already fundamentally serialized, so the coexistence of all these tasks wastes quite a lot of memory. Any work pipeline (a collection of tasks) that's fundamentally serial can be moved to share the same WorkQueue. Then we can lean on the uORB publication to schedule appropriate work.