Main Content

ROS ログ ファイルと変換


ROS のトピックは "rosbag" と呼ばれるログ ファイルに保存されます。MATLAB® でこれらの rosbag 内の情報にアクセスして、フィルター処理できます。rosbag の処理例は、Work with rosbag Logfilesを参照してください。

座標系間の変換に ROS トピックとしてアクセスし、それらを使用して MATLAB でデータを変換できます。詳細については、Access the tf Transformation Tree in ROSを参照してください。

rosrate オブジェクトは、コード実行のタイミングを制御する上で役立ちます。



rosbagrosbag ログ ファイルを開いて解析
readMessagesrosbag からのメッセージの読み取り
selectSelect subset of messages in rosbag
timeseriesCreates a time series object for selected message properties
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
applyTransform 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 Conversion指定した座標変換表現への変換


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. These bags are often created by subscribing to one or more ROS topics, and storing the received message data in an efficient file structure. MATLAB® can read these rosbag files and help with filtering and extracting message data. See ROS Log Files (rosbags) for more information about rosbag support in MATLAB.

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. tf is distributed, so that all coordinate frame information is available to every node in the ROS network. MATLAB® enables you to access this transformation tree. This example familiarizes you with accessing the available coordinate frames, retrieving transformations between them, and transform points, vectors, and other entities between any two coordinate frames.

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. Use the Current Time block and assign the output to the std_msgs/Header message in the Stamp field. Publish the message on a desired topic.

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 transmation. Use bus selectors to extract the rotation and translation vectors. The Coordinate Transformation Conversion block takes the rotation vector (euler angles) and translation vector in and gives the homogeneous transformation for the message.