ros2topicsynchronizer
Description
Use the ros2topicsynchronizer object to time synchronize messages
published at different frequencies across multiple topics in the ROS 2 network. You can obtain
a set of the most recent messages that are synchronized to be closest in time across all
topics included in the object. To add topics to the ros2topicsynchronizer
object, use the addTopic object function. Alternatively, you can create a
custom callback function and provide that as input to the
ros2topicsynchronizer object, enabling the object to run the callback
function every time a set of synchronized messages becomes available.
The ros2topicsynchronizer object can time synchronize messages across a
minimum of two, to a maximum of nine topics. The ros2topicsynchronizer
supports time synchronization of only those messages that contain the
std_msgs/header field.
Follow these steps to time synchronize messages across multiple topics:
Create the
ros2topicsynchronizerobject and specify the desired time-synchronization policy.Add the desired topics for time synchronization using the
addTopicobject function.Initiate the synchronization using the
synchronizeobject function.
The ros2topicsynchronizer object supports various policies that achieve
the time-synchronization process in slightly different ways. You can specify the desired
policy when you create the ros2topicsynchronizer object.
Creation
Description
creates a syncObj = ros2topicsynchronizer(policy)ros2topicsynchronizer object with the specified synchronization
policy.
specifies additional options using one or more name-value arguments.syncObj = ros2topicsynchronizer(policy,Name=Value)
Input Arguments
Name-Value Arguments
Properties
Object Functions
addTopic | Add ROS 2 topic for time-synchronization of messages |
synchronize | Initiate time synchronization of messages across added ROS 2 topics |
Examples
Version History
Introduced in R2026a