Skip to content

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

Open
@Deduard

Description

@Deduard

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions