www.gusucode.com > robotsimulink 工具箱 matlab源码程序 > robotsimulink/robotslros/+robotics/+slros/+internal/+cgen/getNodeDependencies.m
function info = getNodeDependencies(msgTypes) %This function is for internal use only. It may be removed in the future. % INFO = getNodeDependencies(MSGTYPES) takes a list of ROS message types, % and returns the set of ROS packages that ship those message types. % INFO is a struct with fields 'messageList' and 'nodeDependencies' % (cell arrays of strings). % % For example, if a message type is 'geometry_msgs/Point', the % corresponding package is 'geometry_msgs'. % Copyright 2014 The MathWorks, Inc. msgTypes = unique(msgTypes); tokens = regexp(msgTypes, '^(\w*)/', 'tokens'); dependencies = {}; for i=1:numel(tokens) if ~isempty(tokens{i}) dependencies{end+1} = tokens{i}{1}{1}; %#ok<AGROW> end end info.messageList = msgTypes; info.nodeDependencies = dependencies;