Matlab Error creating ROS Node

16 views (last 30 days)
Saharsh Bansal
Saharsh Bansal on 16 Jun 2021
Moved: Remo Pillat on 25 Jan 2024
I am trying to create a ROS node using Matlab on my windows machine on a ROS network initiated on a VM on the same PC.
Code I use:
rosinit("http://x.x.x.x:11311")
I'm using 2021a. The node was created successfully. However, now when I try to recreate the node(after a full restart cycle for unrelated reasons), I get the error message:
"Error creating the ROS node /matlab_global_node_xxxxx".
Incidentally this error does not pop up when I use older versions such as 2020a or even 20b.
  4 Comments
Jagadeesh Konakalla
Jagadeesh Konakalla on 17 Jun 2021
Hi Saharsh,
My understanding is that you were able to run rosinit successfully. When you run into some unrelated issues, you restarted MATLAB and VM. From then you are running into issues. Is that my understanding correct ?
Have you made any changes to your VM ?
To isolate the issue, let us do the following.
  1. Restart the MATLAB.
  2. Create a Master locally and create a node on the local machine. Please use the following code.
master = ros.Core;
node = ros.Node('/test_node_1');
If the above code works, things should be mostly good on MATLAB side.
Can you make sure that in your VM, you are able to create a node using sample C++ code (running sample listener example and make sure that node is running) .
Thanks,
Jagadeesh K
Saharsh Bansal
Saharsh Bansal on 17 Jun 2021
I didn't make any changes to my VM. As I had mentioned earlier, this error does not pop up when I use older versions of MATLAB, 2020a and 20b.
Additionally I tried to create a node using 2020a, when 21a gave the error, and it connected just fine. Other external nodes are also able to connect to the VM just fine.
I also tried the above commands you suggested and the results are as:
master = ros.Core;
Error using ros.internal.createOrGetLocalPython (line 102)
Could not find Python version 2.7 on your system. Use pyenv function to set the path to the Python 2.7 executable.
I changed the pythonn env to 2.7, then got the error on the line:
node=ros.Node('/test_node_1')
When I try to run it from the cmd windows which pops up it gives a throw error, Connot find module.
As a side note, I tried reinstalling 2021a, and rosinit worked, but only once. When trying to access nodes/topics on the network it gives a Connection lost error.
The thing which confuses me the most is that this only happens with 2021a, but not with 2020a/b

Sign in to comment.

Answers (1)

Jagadeesh Konakalla
Jagadeesh Konakalla on 17 Jun 2021
Moved: Remo Pillat on 25 Jan 2024
Hi Saharsh,
I was not sure about Cannot find module error. Are you seeing this error on the MATLAB Command window ?
It is not clear for me when you say connection lost error. Can you please elaborate ?
We have couple of backend changes from 20a release to 20b release. You mentioned that it is working on 20b, then it should work on 21 also.
I suggest you to reachout to us through the MathWorks Technical Supoort for further debugging the issue.
Thanks,
Jagadeesh K

Categories

Find more on Network Connection and Exploration in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!