Matlab Error creating ROS Node

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 comentarios

Jagadeesh Konakalla
Jagadeesh Konakalla el 17 de Jun. de 2021
Hi Saharsh Bansal,
Can you clarify the following ?
  1. What do you mean by full restart cycle ? Do you mean that you have restarted MATLAB ?
  2. After restart have you tried rosinit again ?
  3. Can you provide the exatc error message that you see in the MATLAB command window ?
  4. You said that you were trying to recreate the node. Are you using the ros.Node API ?
Thanks,
Jagadeesh K.
Saharsh Bansal
Saharsh Bansal el 17 de Jun. de 2021
Hi Jagadeesh,
1) Yes I restarted Matlab. When the error kept coming up, I even went ahead and restarted the ROS network.
2) Yes after the restart I tried rosinit again. To be specific the code you see above.
3) The exact message is "Error creating the ROS node /matlab_global_node_xxxxx". This is all that is shown on the command window.
4) When i meant recreate the node, I meant reconnect Matlab to the ROS network after the restart as in point 2)
I hope this helps in finding a resolution.
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
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

Iniciar sesión para comentar.

Respuestas (1)

Jagadeesh Konakalla
Jagadeesh Konakalla el 17 de Jun. de 2021
Movida: Remo Pillat el 25 de En. de 2024

0 votos

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

Categorías

Productos

Versión

R2021a

Preguntada:

el 16 de Jun. de 2021

Movida:

el 25 de En. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by