Main Content

Read Data

Play back data from log file

  • Library:
  • ROS Toolbox / ROS

  • Read Data block

Description

TheRead Datablock plays back rosbag logfiles by outputting the most recent message from the log file based on the current simulation time. You must load a rosbag log file (.bag) and specify theTopicin the block mask to get a stream of messages from the file. Messages on this topic are output from the file in sync with the simulation time.

In theRead Datablock mask, clickLoad log file datato specify a rosbag log file (.bag) to load. In theLoad Log Filewindow, specify aStart time offset, in seconds, to start playback at a certain point in the file.Durationspecifies how long the block should play back this file in seconds. By default, the block outputs all messages for the specificTopicin the file.

Ports

Output

expand all

New message indicator, returned as a logical. If the output is1, then a new message was loaded from the rosbag file at that time. This output can be used to trigger subsystems for processing new messages received.

ROS message, returned as a nonvirtual bus. Messages are output in the order they are stored in the rosbag and synced with the simulation time.

Data Types:bus

Parameters

expand all

Topic name to extract from log file, specified as a string. This topic must exist in the loaded rosbag. Click theLoad rosbag fileUseSelect ...检查可用的主题,选择一个specific topic.

Interval between outputs, specified as a scalar. In simulation, the sample time follows simulation time and not actual wall-clock time.

This default value indicates that the block sample time isinherited.

For more information about the inherited sample time type, seeSpecify Sample Time(Simulink).

Version History

Introduced in R2019b