www.gusucode.com > robotsimulink 工具箱 matlab源码程序 > robotsimulink/robotslros/+robotics/+slros/+internal/+diag/recoverROSFolderFromStdLocation.m

    function returnInfo = recoverROSFolderFromStdLocation( hostname, sshPort, username, password )
%This function is for internal use only. It may be removed in the future.

%recoverROSFolderFromStdLocation Recover the ROS installation folder from standard locations
%   This function is called by the "FixIt" diagnostic action if the ROS
%   folder is not valid and the user wants to search the standard
%   installation locations.

%   Copyright 2016 The MathWorks, Inc.

% Connect to the device
diag = robotics.slros.internal.diag.DeviceDiagnostics;
diag.connect(hostname, sshPort, username, password);

% Recover the set of ROS folders that denote standard locations.
% This will return empty if the operation fails.
rosFolders = diag.recoverROSFolderFromStandardLocations;

if isempty(rosFolders)
    % Did not find a install ROS folder. Throw an exception.
    error(message('robotics:robotslros:devicediag:ROSFolderStdRecoveryFailure'));
end

% Found at least 1 ROS installation folder. Enumerate them.
msgArray = cell(length(rosFolders), 1);
for i = 1:length(rosFolders)
    folder = rosFolders{i};
    distName = diag.getROSDistribution(folder);
    msgArray{i} = message('robotics:robotslros:devicediag:ROSFolderRecoverySuccess', upper(distName), folder).getString;
end
% Introduce a newline before printing the message for each rosfolder
returnInfo = sprintf('\n%s', msgArray{:});
end