Hi all, Your Friendly Neighborhood Navigator here! I have an important, yet subtle feature announcement to make which I think is worth expanding upon in Discourse in a little detail to make sure everyone understands the value and how to use it properly.
This PR introduces a new parameter
use_realtime_priority to the Controller Server. This parameter will elevate the Controller Server’s action-server callback thread priority to better align with real-time with your OS. This is an important feature because previously, the OS’ scheduler controlled when to wake the Controller Server’s thread to compute the next control effort with a fair degree of variability. You’d end up in situations where the server will complain about missing deadlines when the computer is easily able to keep those deadlines due to its lack of priority over other less time-sensitive processes. This causes many down-the-line issues, especially when a system is expecting a regular stream of commands or using predictive techniques that expect regularity.
For example, DWB by the default configuration can run around 140hz on my computer before capping out and occasionally throwing me a warning that we’re reaching its limits. Without
use_realtime_priority, I start seeing those messages around 75hz. I tested in more detail with MPPI and showed that over an hour of navigation, it never triggered a warning of missing deadlines except when an iteration literally did miss the deadline (e.g. so no more thread-waking induced delays).
Thus, this is a pretty important update that all Nav2 users should be aware of and I highly recommend enabling it as soon as it is available in your distribution (luckily it can be backported to all current distribution!). The only catch is that it requires an update to
/etc/security/limits.conf to enable user-defined thread priorities & a reboot:
<username> hard rtprio 99 <username> soft rtprio 99
Thus, this feature is not enabled by default. This feature was added generically within the Simple Action Server, so those using that for their own servers can also enable this with a change of a bool. Today, its only enabled in the Controller Server, since that is the only truly time-sensitive server that we see manifest impacts in. However, it would be possible in the future to expand this to all action servers and data processing if that turns out to be adventitious for users’ applications.