Main Content

ROS Log Files and Transformations

Analyze rosbags, transformation trees, and time series data

ROS topics are stored in log files called rosbags. You can access and filter information from these rosbags in MATLAB®. For an example of working with rosbags, see Work with rosbag Logfiles.

You can access transformations between coordinate systems as ROS topics and use them to transform data in MATLAB. For more information, see Access the tf Transformation Tree in ROS.

The rosrate object helps control the timing of code execution.


expand all

rosbagOpen and parse rosbag log file
readMessagesRead messages from rosbag
selectSelect subset of messages in rosbag
timeseriesCreates a time series object for selected message properties
ros2bagOpen and parse ros2bag log file
readMessagesRead messages from ros2bag object
selectSelect subset of messages in ros2bag
rostimeAccess ROS time functionality
rosrateExecute loop at fixed frequency
rosdurationCreate a ROS duration object
rostfReceive, send, and apply ROS transformations
secondsReturns seconds of a time or duration
rosApplyTransformTransform message entities into target frame
canTransformVerify if transformation is available
transformTransform message entities into target coordinate frame
waitForTransformWait until a transformation is available
getTransformRetrieve transformation between two coordinate frames
sendTransformSend transformation to ROS network


BagSelection Object for storing rosbag selection
TransformStampedCreate transformation message


Read DataPlay back data from log file
Coordinate Transformation ConversionConvert to a specified coordinate transformation representation


ROS Log Files (rosbags)

Summary of the structure of rosbags and the workflow for selecting subsets of messages in a rosbag.

Work with rosbag Logfiles

A rosbag or bag is a file format in ROS for storing message data.

Access the tf Transformation Tree in ROS

The tf system in ROS keeps track of multiple coordinate frames and maintains the relationship between them in a tree structure.

Execute Code Based on ROS Time

Using a rosrate object allows you to control the rate of your code execution based on the ROS Time /clock topic.

Time Stamp a ROS Message Using Current Time in Simulink

This example shows how to time stamp a ROS message with the current system time of your computer.

Convert a ROS Pose Message to a Homogeneous Transformation

This model subscribes to a Pose message on the ROS network and converts it to a homogeneous transformation.