function exampleHelperResetSimulation(scene,traj,lidarSensors,egoMap,reconLayer)
%exampleHelperResetSimulation Reset persistent elements of the scene

% Copyright 2020 The MathWorks, Inc.

    % Restart all scenario-related objects
    restart(scene);
    reset(traj);
    for i = 1:numel(lidarSensors)
        reset(lidarSensors{i});
    end
    
    % Move the egoMap back to start location and clear layers
    poses = actorPoses(scene);
    currentPose = [poses(1).Position(1:2) poses(1).Yaw/180*pi];
    move(egoMap, currentPose(1:2));
    for i = 1:egoMap.NumLayers
        setMapData(egoMap,egoMap.LayerNames{i},repmat(egoMap.DefaultValue{i},egoMap.GridSize));
    end
    
    % Clear the world map
    setMapData(reconLayer,repmat(reconLayer.DefaultValue,reconLayer.GridSize));
end