필터 지우기
필터 지우기

Issues connecting MATLAB to Turtlebot4

조회 수: 11 (최근 30일)
Kai
Kai 2023년 12월 5일
댓글: Kai 2023년 12월 22일
I am trying to connect MATLAB R2023b on Ubuntu 22.04 to my Turtlebot4 using:
rosinit("http://192.168.1.3:11311");
I have checked my ROS_MASTER_URI on both my PC and the RPi.
On my PC:
$ echo $ROS_MASTER_URI
http://localhost:11311
On my RPi:
$ echo $ROS_MASTER_URI
http://192.168.1.3:11311
When I tried to do rosinit, MATLAB outputs the error:
Cannot connect to ROS master at http://192.168.1.3:11311. Check the specified address or hostname.
Am I missing something here? Any help would be greatly appreciated!

답변 (2개)

Ashutosh Thakur
Ashutosh Thakur 2023년 12월 19일
Hi Kai,
I understand that you are facing issue with connecting MATLAB with TurtleBot4.
Following are the suggestion which may help you in troubleshooting the issue:
  • Check the firewall and network settings and also check if all required ports are open for ROS communication.
  • Verify the ROS_HOSTNAME environment variable on both your PC and the RPi. It should be set to the IP address of the respective machine to ensure that ROS communication occurs over the correct network interface.
  • Also ensure that MATLAB has necessary permissions to access the network.
Kindly follow these documentation links which would help in understanding the ROS connectivity in MATLAB:
I hope this helps you in troibleshooting the issue.
  댓글 수: 1
Kai
Kai 2023년 12월 22일
Hi, thanks for your reply.
First, to check for any firewall:
$ sudo ufw status
Status: inactive
Which means there are no firewalls active. I also checked the ports using
$ netstat -a
and all of them are CONNECTED or LISTENING.
Next, I verified that the ROS_IP on my host computer is 192.168.1.4 and the ROS_IP on my Turtlebot4 Rpi is 192.168.1.3. My ROS_MASTER_URI for both are the same, http://192.168.1.3://11311
Not sure how to check MATLAB permissions though, but it is a fresh install.
It still does not work.

댓글을 달려면 로그인하십시오.


Raj
Raj 2023년 12월 20일
Adding on to the answer mentioned above, you can also check the following points to troubleshoot your issue
  • Verify both the host machine and Turtlebot4 are connected to the same network
  • Set ROS_MASTER_URI on both the host machine and the Rpi
  • On Turtlebot, set ROS_IP to match the Turtlebot IP address
If the problem persists, try initializing ROS on your Rpi as well. You can later use the following command to check if ROS master is up and running
bool ros ::master::check()
If the master is available it will return true, else it will return false.
I hope you are able to proceed further
  댓글 수: 1
Kai
Kai 2023년 12월 22일
Hi, thanks for your reply.
I have verified that they are connected to the same network. I can ping the turtlebot from the host computer's terminal and also the host computer from the turtlebot's terminal.
Yes, my ROS_MASTER_URI is the same http://192.168.1.3://11311.
Yes, my ROS_IP in the turtlebot's terminal is 192.168.1.3.
The command
bool ros ::master::check()
does not work when I entered it into the MATLAB command window.
It outputs: Unrecognized function or variable 'bool'.
Any further help would be greatly appreciated.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Network Connection and Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by