フィルターのクリア

Cannot connect to ROS master running on virtual machine

41 ビュー (過去 30 日間)
caesar
caesar 2018 年 4 月 3 日
コメント済み: Adil Farooq 2023 年 1 月 11 日
Matlab cannot connect to ROS master on virtual machine. here are the complete setup :
I am using Matlab 2017B on my host machine, also have Ubuntu 16.04 LTS and ROS kinetic running on Virtual machine (Virtualbox).
the Ifconfig result is :
ethernet address: 10.0.2.15 (on Ubuntu)
on host machine :
ipconfig
130.209.140.237
on Ubuntu
$ echo $ROS_MASTER_URI
http://10.0.2.15:11311
$ echo $ROS_HOSTNAME
10.0.2.15
i had tried many ways to connect to ROS master on Matlab :
1-
rosinit ('10.0.2.15', 'NodeHost', '130.209.140.237')
2-
setenv('ROS_MASTER_URI','http://10.0.2.15:11311')
setenv('ROS_IP','130.209.140.237')
rosinit
and same error message:
Cannot connect to ROS master at http://10.0.2.15:11311. Check the specified address or hostname.
also , i tried to ping the virtual machine but no reply :
ping 10.0.2.15
request time out
one last thing , I have attached an image showing the 'Network' setting for my virtual machine . has anyone faced the same problem before?
thanks in advanced
  2 件のコメント
Sebastian Castro
Sebastian Castro 2018 年 4 月 5 日
If you can't even ping the VM, this might be a firewall issue.
Make sure that both programs (MATLAB and VirtualBox) are allowed by the firewall, assuming you have one.
Ameer Hamza
Ameer Hamza 2018 年 4 月 20 日

@caesar I can not find the image you attached to the question, but it appears that you might be using NAT network to interface guest VM with the host. The host cannot reach guest behind NAT network. You either need to use Bridged Network or Host-only Adapter to communicate between both machines.

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

回答 (3 件)

Stefano Dalla Gasperina
Stefano Dalla Gasperina 2019 年 2 月 7 日
@caesar, I got the same issue and I was able to solve by setting the "Bridged Adapter" mode in the VirtualBox Network Settings. Actually, by using the "Bridge" mode, your VM will get a ip address on the same subnet as your host, while in default "NAT" mode your host will act as a router (firewall) and your VM will be on a private subnet (e.g. ip 10.0.2.15).
Capture.PNG
After doing this, just type in the terminal of your VM
$ ipconfig
to find the IP address and type in MATLAB:
rosinit('http://ROS_MASTER_URI:11311')
where "http://ROS_MASTER_URI:11311" is exactly what you got from e
$ echo $ROS_MASTER_URI
To check then type on your VM:
$ rosnode list
and you should see the global node from MATLAB.
I believe this will also work with Simulink ROS-Node Deployment.
Hope this will help.
Cheers
Stex
  1 件のコメント
Samuel Ayankoso
Samuel Ayankoso 2020 年 8 月 5 日
Thank you for the clarity you provided to this problem

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


Moe Jordan
Moe Jordan 2018 年 4 月 14 日
@caesar did you manage to solve the issue? I have the same problem...
  2 件のコメント
caesar
caesar 2018 年 10 月 16 日
didn't resolve, unfortunately,so I had to install a dual operating system on my machine to workaround this
Adil Farooq
Adil Farooq 2023 年 1 月 11 日
did you use 2 systems or ran matlab and gazebo on dual boot?

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


Chin Wei Chang
Chin Wei Chang 2018 年 10 月 10 日
1.In the network setting, you have to use Bridge Adapter.
2.Open up a new terminal, and run "roscore".
Then connect to ROS master on Matlab again.
  1 件のコメント
caesar
caesar 2018 年 10 月 16 日
tried every possible option in the network setting but didn't work at all.

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by