Issues connecting MATLAB to Turtlebot4
Ältere Kommentare anzeigen
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!
Antworten (2)
Ashutosh Thakur
am 19 Dez. 2023
0 Stimmen
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:
- https://www.mathworks.com/help/ros/ug/connect-to-a-ros-network.html
- https://www.mathworks.com/help/ros/ug/communicate-with-the-turtlebot.html
I hope this helps you in troibleshooting the issue.
Raj
am 20 Dez. 2023
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
Kategorien
Mehr zu Network Connection and Exploration finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!