Play Back Data from ROS 2 Bag Logfile in Simulink®
Use the Read Data block to play back data from a ROS 2 bag logfile.
Set up Model
Open the Read Data block mask to load a ROS 2 bag logfile (
Click the Load logfile data link.
Browse for the logfile and specify a time offset or limited duration if needed. The
ros2_bag.db3file and the associated
metadata.yamlfile are attached to this example.
Select the desired topic,
The Read Data block outputs the messages from the ROS 2 bag logfile.
A bus selector extracts the xy-position from the
The block plays back data in sync with the simulation time. The Record plot displays the robot position over time.