PX4 / DriverFramework

Operating system and flight stack agnostic driver framework for POSIX (Linux, NuttX, Mac OS, QNX, VxWorks).
82 stars 132 forks source link

Priority way too low #230

Closed bartslinger closed 6 years ago

bartslinger commented 6 years ago

I am experiencing issues on Bebop 2 because the DriverFramework priority is hard-coded to 10 (!!). Basically everything else is running at a higher priority. This is terrible because now we have IMU and MAG on the lowest priority.

https://github.com/PX4/DriverFramework/blob/master/framework/src/DriverFramework.cpp#L333

However I'm not sure what would be an appropriate value here. That's what I'd like to discuss in this issue.

julianoes commented 6 years ago

Interesting find! Have you tried changing it and tested the results?

bartslinger commented 6 years ago

I got a ton of warnings like Accel TIMEOUT when running heavy calculations (opencv stuff) in another thread at prio 35. Then I changed DriverFramework priority from 10 to 97 and those warnings disappeared. On linux systems such as bebop, the priority range for SCHED_FIFO is 1 to 99. I don't know if other posix px4 systems exist with different priority ranges.

wkr_hrt and bebop_bus_esc_main are at prio 99. hpwork is at prio 98. There might be more because I only checked the tasks threads.

mhkabir commented 6 years ago

@bartslinger Tangential question, are you running OpenCV onboard the Bebop?

julianoes commented 6 years ago

@bartslinger to me it seems like it makes sense to bump the priority then.

bartslinger commented 6 years ago

I'll try at highest priority today SCHED_PRIORITY_MAX, which I think it should be. Let's see what that does to hpwork and wkr_hrt

@mhkabir Yes, I cross compiled it and linked it to px4. I'll make that available when it's ready.