PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

uXRCE - Allow to set the uORB polling rate per subscription

Open AlexisTM opened this issue 6 months ago • 6 comments

Solved Problem

Having a configurable polling rate can have 2 usages:

  • Increase the polling interval for rate limiting of uORB message
  • Decrease the polling interface for reducing the latency of critical topics

The main issue with latency is if we have a 100Hz topic with a 10ms interface, which means we will get a systematic delay between [0-10ms] which is different for each run.

This is especially important to have little/limited delays when using external control modes such as with Auterion/px4-ros2-interface-lib

Solution

  • Add an optional max_rate_hz parameter to the dds_topics.yaml file
  • Moved the optional default_max_rate_hz parameter to the dds_topics.yaml file or set it to 100
  • Use the new max_rate_hz parameter or the default rate

Changelog Entry

For release notes:

Feature/Add the max frequency per subscription for uXRCE
New parameter: `max_rate_hz` in `dds_topics.yaml` to set the uORB subscription maximal data frequency.
New parameter: `default_max_rate_hz` in `dds_topics.yaml` 
Higher frequency (1000Hz) on a lower frequency channel (100Hz) will reduce latencies. 
A max frequency of `0 Hz` means `unlimited`. 

Alternatives

We could make the default interval as a PX4 parameter, but that impacts every topic. Not all topics needs a low polling interval.

Closes: https://github.com/PX4/PX4-Autopilot/pull/21716 Closes: https://github.com/PX4/PX4-Autopilot/pull/21997

AlexisTM avatar Jul 31 '24 13:07 AlexisTM