Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

topic statistics doesn't publish "message_age" data if QoS is Keep last. #83

Open
hsgwa opened this issue Jan 22, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@hsgwa
Copy link
Contributor

hsgwa commented Jan 22, 2021

Description

topic statistics doesn't publish "message_age" data if subscription's QoS is Keep last.

Expected Behavior

$ ros2 topic echo /topic_statistics # in another terminal
~~
metrics_source: message_age
~~
metrics_source: message_period
~~
metrics_source: message_age
~~
metrics_source: message_period

Both message_age and message_period are published.

Actual Behavior

$ ros2 topic echo /topic_statistics # in another terminal
~~
metrics_source: message_period
~~
metrics_source: message_period

Only message_period are published.

To Reproduce

I've implemented test case.

$ cd ~/ros2_ws/
$ git clone -b qos_history_1 https://github.com/hsgwa/intra_process_ping_latency_test.git src/intra_process_ping_latency_test
$ colcon build --packages-select intra_process_ping_latency_test
$ . ~/ros2_ws/install/local_setup.bash
$ ros2 run intra_process_ping_latency_test ping_test
$ ros2 topic echo /topic_statistics # in another terminal

System

  • OS: Ubuntu 20.04.1 LTS (Focal Fossa)
  • ROS 2 Distro: Rolling

Additional context

As far as I read source code, this issues seems be caused by following reason.

  1. topic statistic's publisher takes over subscriber's QoS.
    https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/create_subscription.hpp#L88
  2. publish_message() publishes "message_age" and then "message_period" almost simultaneously.
    Here, second message (message_period) overwrites first message (message_age) if QoS depth = Keep Last.
    https://github.com/ros2/rclcpp/blob/master/rclcpp/include/rclcpp/topic_statistics/subscription_topic_statistics.hpp#L152

--

I posted this issue to libsatistics_collector because this bug is related to topic statistics, but I probably should have published it to rclcpp.
If you have any comments, I will republish this issue to rclcpp.

@hsgwa hsgwa added the bug Something isn't working label Jan 22, 2021
@emersonknapp
Copy link
Contributor

Will try to reproduce today - if this is the case, it probably also affects Foxy and any fix will need to be backported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants