ros2 / ros2/ros2cli

topic delay performance overhead

Open
#1,214 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
262
Forks
228
Avg merge
23h 15m
Merged PRs (30d)
12

Description

When trying to measure the topic delay of camera images for a real time setup, I found that ros2 topic delay is not very well suited for this:

  • too few digits and metrics to measure millisecond delays
  • using python to calculate the delay introduces a notable overhead

This can be well seen if comparing it against a custom c++ tooling i've created for those reasons:

ros2 topic delay /camera02/pylon_ros2_camera_node/image_raw 
average delay: 0.014 	min: 0.014s max: 0.015s std dev: 0.00016s window: 131
average delay: 0.014	min: 0.014s max: 0.015s std dev: 0.00015s window: 181
average delay: 0.014	min: 0.014s max: 0.015s std dev: 0.00015s window: 231
average delay: 0.014	min: 0.014s max: 0.015s std dev: 0.00014s window: 281
average delay: 0.014	min: 0.014s max: 0.015s std dev: 0.00014s window: 331
ros2 run micro_delay micro_delay --ros-args -p topic:=/camera02/pylon_ros2_camera_node/image_raw
Avg: 0.012300s | Min: 0.012173s | P5: 0.012185s | P50: 0.012308s | P95: 0.012422s | Max: 0.012436s
Avg: 0.012321s | Min: 0.012186s | P5: 0.012194s | P50: 0.012323s | P95: 0.012513s | Max: 0.012531s
Avg: 0.012347s | Min: 0.012180s | P5: 0.012197s | P50: 0.012352s | P95: 0.012506s | Max: 0.012522s
Avg: 0.012358s | Min: 0.012172s | P5: 0.012194s | P50: 0.012374s | P95: 0.012473s | Max: 0.012477s
Avg: 0.012375s | Min: 0.012251s | P5: 0.012266s | P50: 0.012403s | P95: 0.012460s | Max: 0.012463s

The delay measured by my custom c++ tool is around 2ms less than the one reported by ros2 topic delay. I assume the main difference is caused by the better optimized programming language.

One important advantage of the python implementation here is that it works with arbitrary topics, while my c++ version only with sensor_msgs::msg::Image. So I can't provide an adequate replacement, but only inform about this possible performance problem.

The code for the micro_delay tool can be found here: https://gitlab.com/Percipiote/CamStreamer/-/blob/master/extras/delay/micro_delay/src/micro_delay.cpp

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ros2 topic delay entry point and compare its measurements with the referenced micro_delay.cpp tool on the same camera image topic. Determine whether the reported overhead can be reduced while retaining support for arbitrary topics; done should include reproducible millisecond-level measurements and evidence that the command remains general.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
cli, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.