%exampleHelperGazeboCleanupBowling
%   Cleans up the models added to Gazebo in the GazeboAddBuildAndRemoveObjectsExample example.
%   Removes the large ball, the two Jersey barriers, and all ten bowling
%   pins.
%
%   See also GazeboAddBuildAndRemoveObjectsExample

%   Copyright 2014 The MathWorks, Inc.

% Remove ball
try
    removeModel(gazebo,'Ball');
catch
    disp('Error while removing ball');
end

% Remove pins
name = 'BowlPin';
modname = name;

for i = 1:10
    try
        removeModel(gazebo,modname);
    catch
        disp(['Error while removing' name]);
    end
    modname = [name '_' num2str(i-1)];
end

% Remove barriers
try
    removeModel(gazebo,'jersey_barrier');
catch
    disp('Error while removing jersey_barrier');
end

try
    removeModel(gazebo,'jersey_barrier_0');
catch
    disp('Error while removing jersey_barrier_0');
end