www.gusucode.com > robotics 案例源码程序 matlab代码 > robotics/ConnectToMultipleROSMastersExample.m
%% Connect to Multiple ROS Masters % Connecting to multiple ROS masters is possible using MATLAB(R). These % seperate ROS masters do not share information and must have different port % numbers. Connect ROS nodes to each master based on how you want to % separate information across the network. % Copyright 2015 The MathWorks, Inc. %% % Create two ROS masters on different ports. m1 = robotics.ros.Core; % Default port of 11311 m2 = robotics.ros.Core(12000); %% % Connect separate ROS nodes to each ROS master. node1 = robotics.ros.Node('/test_node_1','localhost',11311); node2 = robotics.ros.Node('/test_node_2','localhost',12000); %% % Clear the ROS nodes. Shut down the ROS masters. clear('node1','node2') clear('m1','m2')