%% Play Back Data from Jackal rosbag Logfile in Simulink
% Use the Read Data block to play back data from a rosbag logfile recorded 
% from a Jackal&trade; robot from ClearPath Robotics&trade;.

% Copyright 2019 The MathWorks, Inc. 

%%
% Load the model.
open_system('read_jackal_pose_log.slx')

%%
% Open the Read Data block mask to load a rosbag logfile. Click the Load 
% logfile data link. Browse for the logfile and specify a time offset or 
% limited duration if needed. The |jackal_sim.bag| file is attached to this
% example.
%
% Select the desired topic, |/odometry/filtered|, which contains 
% |nav_msgs/Odometry| messages. The Read Data block outputs the messages from  
% the rosbag logfile. A bus selector extracts the xy-position from the 
% |nav_msgs/Odometry| messages
%%
% Run the model. The block plays back data in sync with the simulation 
% time. The XY Graph plot displays the robot position over time.
sim(gcs)