Hauptinhalt

ROS 2 Bag File Logging and Analysis

R2026b
Import, visualize, and analyze ROS 2 bag files

ROS Toolbox allows access to the message data in ROS 2 bag files orros2bags. You can filter the ROS 2 data and execute offline analysis in these ros2bag files.

To extract message data from a ros2bag log file, use the ros2bagreader object. To write logs to a ros2bag log file, use the ros2bagwriter object. To record data to a ros2bag log file, use the ros2bagrecorder object. To play the bag file data recorded to the ROS 2 network, use the ros2bagplayer object. You can also record ROS 2 messages during a Simulink® simulation by using the ROS 2 Logger app. For more information, see Use ROS 2 Logger App to Save ROS 2 Messages from Simulink.

To visualize the messages in ROS 2 bag log file or view a live ROS 2 topic, use the ROS Data Analyzer app.

Apps

ROS Data AnalyzerVisualize messages from live ROS or ROS 2 topics, bag files, and MCAP files with non-ROS schemas (Since R2023a)

Functions

expand all

ros2bagreaderAccess ROS 2 bag log file information
readMessagesRead messages from ros2bagreader object
selectSelect subset of messages in ros2bagreader
getTransformReturn transformation between two coordinate frames (Since R2023b)
canTransformVerify if transformation is available (Since R2023b)
timetableCreate timetable for selected message properties in ROS 2 bag file (Since R2024a)
ros2bagwriterCreate and write logs to ROS 2 bag log file (Since R2022b)
writeWrite logs to ROS 2 bag log file (Since R2022b)
deleteRemove ros2bagwriter object from memory (Since R2022b)
ros2bagrecorder Record live topic data from ROS 2 network to bag file (Since R2026a)
startRecordingStart recording live topic data from ROS 2 network into bag file (Since R2026a)
pauseRecordingPause recording live topic data from ROS 2 network without closing bag writer (Since R2026a)
resumeRecordingResume recording live topic data from a ROS 2 network after pausing (Since R2026a)
stopRecordingStop recording live topic data from ROS 2 network (Since R2026a)
ros2bagplayerReplay ROS 2 bag data to ROS 2 network (Since R2026b)
startPlayingStart playing ROS 2 bag data to ROS 2 network (Since R2026b)
stopPlayingStop playing ROS 2 bag data to ROS 2 network (Since R2026b)
pausePlayingPause playing ROS 2 bag data without losing playback state (Since R2026b)
resumePlayingResume playing ROS 2 bag data after pausing (Since R2026b)
seekPlayerSeek to target time in ROS 2 bag during replay (Since R2026b)
setRateChange replay rate of ROS 2 bag player (Since R2026b)

Blocks

Read Data ROS 2Read DataPlay back data from ROS 2 log file

Topics

Bag File Analysis

Bag Logging in Simulink

Featured Examples