Issue Connecting to ROS Network on another computer. "Cannot connect to ROS master"

35 ビュー (過去 30 日間)
Colin Szajner
Colin Szajner 2019 年 11 月 26 日
回答済み: Fazal Rahaman Pasha 2024 年 11 月 6 日 20:58
I have been following tutorials online and those provided by Mathworks such as the one linked here:
I am running MATLAB on a Windows 10 computer while running a ROS master on Ubuntu on a separate one.
I used hostname -I to find the ip address of the computer running the ROS master, and attempted to use rosinit('IPaddress') in MATLAB and other methods such as those mentioned in the tutorial and it fails to connect.
The error is "Cannot connect to ROS master at http://IPaddress:11311. Check the specified address or hostname." Where IPaddress is the address gotten using hostname -I in a linux terminal.
I have no firewall on Ubuntu, and I turned off the firewall on my windows pc to no avail as well.
Both are on the same network/internet (my home internet).
Running roscore, my ROS_MASTER_URI is http://localhost:11311. I am using Ubuntu 16.04 and ROS Kinetic.
Any idea how to fix this issue?
  2 件のコメント
Cam Salzberger
Cam Salzberger 2019 年 12 月 5 日
Rather than hostname -l, can you try running "ifconfig" on your Ubuntu machine. That should be a more accurate IP address than what is provided by Windows attempting to resolve the hostname.
Also, try pinging both directions (Windows to Ubuntu at that IP, and Ubuntu to Windows at the Windows IP seen by "ipconfig") to make sure communication in general can get through.
Shivam Bajpai
Shivam Bajpai 2022 年 11 月 4 日
Hi,
Did you fix the issue?

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

回答 (2 件)

Robert Watson
Robert Watson 2023 年 4 月 22 日
I think the problem might be your ROS_MASTER_URI on the computer running roscore. If this is set to local host it can prevent other nodes on the network from accessing it.
To allow external connection, ROS_MASTER_URI set on the host PC should contain its own IP address on the network.
i.e. Both the core host and the client PC should set ROS_MASTER_URI=http://IPaddress:11311

Fazal Rahaman Pasha
Fazal Rahaman Pasha 2024 年 11 月 6 日 20:58
I re-installed the Ros toolbox, and I was not executing "setenv()" function, and executed rosinit.
This worked for me.

カテゴリ

Help Center および File ExchangeNetwork Connection and Exploration についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by