Matlab fails to see nodes in Gazebo VM

5 ビュー (過去 30 日間)
Oren Bell
Oren Bell 2023 年 2 月 23 日
コメント済み: Oren Bell 2023 年 2 月 27 日
I followed all the instructions here, and even took some measures it failed to mention, but I still can't get matlab to talk to the ros1bridge in the ROS VM.
The /etc/hosts files on host and VM both reference each other and I can ping both from the other, by hostname. The ROS_DOMAIN_ID has beeen set correctly. Environmental variables are set. The DEFAULT_FASTRTPS_PROFILES.xml file is in my project folder. And if I open a terminal on the host (outside of matlab), it will correctly display the topics from inside the VM.
So networking configuration is working; the only factor at play here is Matlab itself.
Within the Matlab terminal:
>> setenv("ROS_IP","192.168.93.1")
>> setenv("ROS_MASTER_URI","192.168.93.128")
>> setenv("ROS_DOMAIN_ID","25")
>> node = ros2node("/matlab_node")
node =
ros2node with properties:
Name: '/matlab_node'
ID: 25
>> !ping ubuntu
PING ubuntu (192.168.93.128) 56(84) bytes of data.
64 bytes from ubuntu (192.168.93.128): icmp_seq=1 ttl=64 time=0.172 ms
64 bytes from ubuntu (192.168.93.128): icmp_seq=2 ttl=64 time=0.099 ms
64 bytes from ubuntu (192.168.93.128): icmp_seq=3 ttl=64 time=0.105 ms
^C
--- ubuntu ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2031ms
rtt min/avg/max/mdev = 0.099/0.125/0.172/0.033 ms
>> ros2 topic list
/chatter
/parameter_events
/rosout
>> ros2 node list
/matlab_node
/talker
And from the VM, the matlab node is missing, but nodes I create on the host outside of matlab are visible.
Topics created on the host (but not in the matlab terminal), can be see inside both the VM and in matlab

採用された回答

Josh Chen
Josh Chen 2023 年 2 月 24 日
Hi Oren,
Can you provide more information about the VM you are using here?
  1. Are you using the VM from MathWorks? If yes, which version of MATLAB and VM are you using? You can find ROS/ROS 2 versions used in MATLAB from this page.
  2. What is the Network Adapter mode of your VM? If you are running VM on the same device as your MATLAB, NAT mode normally works well.
Best,
Josh
  1 件のコメント
Oren Bell
Oren Bell 2023 年 2 月 27 日
Yes, it is the default VM from mathworks. It's Matlab 2022b and the VM is ROS Noetic Foxy Gazebo v11.
The network adapter was the issue. Bridged or NAT fixes the issue. It defaulted to host-only. Matlab doesn't like virtualized networks, I guess.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by