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

Inconsistent Behavior of ApproximateTime Synchronizer with Varying Publisher Frequencies in ROS2 #109

Open
Deduard opened this issue Jan 18, 2024 · 0 comments
Assignees

Comments

@Deduard
Copy link

Deduard commented Jan 18, 2024

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • DDS implementation:
    • No DDS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

To test the issue, you can use composable_nodes_test_pkg from:
https://github.com/Deduard/ros2_demo/

The package contains a simple publishing and subscribing node implementation. The subscribing node uses ApproximateTime policy to synchronize messages from three publishers.

The file test_composable_nodes.launch.py contains the following block:

/***
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherNode',
name='publisher_node1',
parameters=[
{'publish_frequency': 30.0,
'topic': 'topic1'}
],
),
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherNode',
name='publisher_node2',
parameters=[
{'publish_frequency': 20.0,
'topic': 'topic2'}
],
),
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherLifecycleNode',
name='publisher_node3',
parameters=[
{'publish_frequency': 10.0,
'topic': 'topic3'}
],
),
***/

(Here the third publishing node is a publishing lifecycle node for the sake of test, though the behavior can be observed also when replacing it with another standard publishing node).

Run with the command:
ros2 launch composable_nodes_test_pkg test_composable_nodes.launch.py

Then swap the publish frequency parameter between publisher_node2 and publisher_node3:

/***
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherNode',
name='publisher_node1',
parameters=[
{'publish_frequency': 30.0,
'topic': 'topic1'}
],
),
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherNode',
name='publisher_node2',
parameters=[
{'publish_frequency': 10.0,
'topic': 'topic2'}
],
),
ComposableNode(
package='composable_nodes_test_pkg',
plugin='PublisherLifecycleNode',
name='publisher_node3',
parameters=[
{'publish_frequency': 20.0,
'topic': 'topic3'}
],
),
***/

and run again.

Expected behavior

The synchronized callback in the subscribing nodes should be called consistently in both situations, regardless of the publishing frequencies.

Actual behavior

In the first case (30, 20, 10 Hz), the Synchronizer callback works as expected. However, in the second case (30, 10, 20 Hz), the callback stops being called after a certain amount of time.

Additional Information

This behavior suggests that the ApproximateTime Synchronizer in ROS2 may have inconsistent performance when one of the topics has a higher message rate than the others. The issue seems to be specifically related to the relative frequencies of the publishers, particularly when the third topic has a higher frequency than at least one of the other two.

@clalancette clalancette transferred this issue from ros2/ros2 Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants