ros2-realtime-demo / pendulum

ROS, ROS2, real-time, control, pendulum
Apache License 2.0
132 stars 38 forks source link

[FEA] check the possibility of merging the patch from concurrentreal-time/ros2_patches. #92

Open ZhenshengLee opened 1 year ago

ZhenshengLee commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Recently I've read the white paper book Bringing Hard Real-Time to ROS 2 with RedHawk Linux https://concurrent-rt.com/wp-content/uploads/2022/10/using-ros-2-on-redhawk-linux.pdf

When running the pendulum demo, it is observed that the latency of the first iteration is much higher than the rest of the iterations. This outlier is caused by the demo not being loaded into cache. In some cases, the initial cache misses of a program when it first starts up can be ignored. Concurrent Real-Time provides a custom patch for the pendulum demo that adds the ability to clear the current statistics while the demo is running. In addition, the patch also improves the initial performance of the pendulum demo when it first starts up. Follow the instructions below to install the patch:

And the comany provided the patches for the repo, https://github.com/concurrentreal-time/ros2_patches/blob/master/demos_patch.patch https://github.com/concurrentreal-time/ros2_patches/blob/master/rttest_patch.patch

The patched pendulum demo greatly helped reduce the worst-case latency for both RedHawk and Ubuntu environments. Ubuntu had a worst case of 420 microseconds, outperforming the unpatched version by over 3,080 microseconds as shown in Figure 4. RedHawk experienced a worst-case latency of 1.45 microseconds, which was a 40.55 microsecond improvement over its unpatched counterpart as shown Figure 5. In addition, RedHawk was able to keep its average latency much closer to its best-case, with its average latency only being 0.2 microseconds off its best-case.

Describe the solution you'd like A clear and concise description of what you want to happen.

  1. Check if the bug reported by the comany still exists in the patched-ubuntu-linux-kernel.
  2. Apply the patch to the main stream
  3. Merge the PR

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Read more materials about the white paper to get more hints.

Additional context Add any other context or screenshots about the feature request here.

Happy to see the potential possibility to use ros2 in a strictly controlled os.

carlossvg commented 1 year ago

@ZhenshengLee Than you for reporting this. I was not aware of that white paper.

Regarding the issue and the patches, I already commented about this here https://github.com/ros2/realtime_support/issues/117. In my opinion, instead of removing the first sample it would be better to fix the first latency spike. But I think it's fine to add some the functionality to clear the statistics. It seems a PR already exists to do that: https://github.com/ros2/realtime_support/pull/118/files