ros2bagplayer
R2026bDescription
Use the ros2bagplayer object to publish messages from a ROS 2 bag
file to the ROS 2 network. Use this object to replay recorded ROS 2 data for simulation, debugging, and algorithm
testing of subscriber nodes with realistic timing without needing the original hardware. You can create multiple player objects on the
same or different bag files. By default, the ros2bagplayer object starts
publishing all topics in the bag. You can also configure include and exclude filtering using
topic names and regular expressions when starting playback. You can pause and resume playback
as many times as needed, seek to a desired time point by using
seekPlayer, and change the playback rate by using
setRate. After stopping playback, you can start playback again on the
same object. To change ros2bagplayer properties, create a new player
object.
Creation
Description
sets player properties using name-value arguments.bagPlayer = ros2bagplayer(bagPath,Name=Value)
Input Arguments
Name-Value Arguments
Output Arguments
Properties
Object Functions
startPlaying | Start playing ROS 2 bag data to ROS 2 network |
stopPlaying | Stop playing ROS 2 bag data to ROS 2 network |
pausePlaying | Pause playing ROS 2 bag data without losing playback state |
resumePlaying | Resume playing ROS 2 bag data after pausing |
seekPlayer | Seek to target time in ROS 2 bag during replay |
setRate | Change replay rate of ROS 2 bag player |
Examples
Version History
Introduced in R2026b
See Also
startPlaying | stopPlaying | pausePlaying | resumePlaying | seekPlayer | setRate | ros2bagrecorder