%% Read Octomap ROS Messages
% Load Octomap ROS messages and read them into MATLAB® as an OccupancyMap3D object.
%
% Load the Octomap ROS messages. The Octomap map messages were previously recorded in a rosbag and read into MATLAB® as ROS message objects. You could also get these ROS messages live on a network.

load octomap_msgs
disp(octomapMsgs{1})

%
% Read the data from the ROS messages into an occupancyMap3D object. Display each map.

for i = 1:length(octomapMsgs)
    msg = octomapMsgs{i};
    map{i} = readOccupancyMap3D(msg);
    figure
    show(map{i});
end    

% Copyright 2019 The MathWorks, Inc.