Does the Robotics System Toolbox support connecting two ROS master core with different ports?

1 回表示 (過去 30 日間)
Bo Shang
Bo Shang 2017 年 8 月 19 日
コメント済み: Bo 2017 年 8 月 24 日
Hello I am trying to use Robotics System Toolbox to connect two drones in Gazebo. The two drones are separated by using different ROS master cores(different port).
On this page https://github.com/osrf/uctf/blob/master/doc/run_example/readme.md they said,"Each vehicle uses a separate ROS master to isolate the payloads from each vehicle."
I wonder if Robotics System Toolbox supports connecting with two different ROS masters at the same time.
If I use Simulink blocks, how to select with ROS master a block is connected to? Thanks, Bo Shang

回答 (1 件)

Sharan Paramasivam Murugesan
Sharan Paramasivam Murugesan 2017 年 8 月 21 日
Yes, it is possible to connect to two different ROS masters simultaneously from MATLAB. These two ROS masters do not share information and must have different port numbers. Connect ROS nodes to these masters based on how you want to separate information across the network.
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');
node2 = robotics.ros.Node('/test_node_2','localhost',12000);
Clear the ROS nodes. Shut down the ROS masters.
clear('node1','node2')
clear('m1','m2')
  1 件のコメント
Bo
Bo 2017 年 8 月 24 日
Do you have some sample projects that use one Simulink file to control two drones in Gazebo?
Thanks,
Bo

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeRobotics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by