Why am I unable to create a ROS2 node on Windows 10?

12 vues (au cours des 30 derniers jours)
MathWorks Support Team
MathWorks Support Team le 5 Nov 2020
I am trying to follow the "Get Started with ROS 2" tutorial below:
However, I get an error when running the first command of the tutorial:
>> test1 = ros2node("/test1")
Error using ros2node/createNode (line 319)
​​​​​​Error creating the ROS 2 node /test1.
Error in ros2node (line 119)
createNode(obj, parser.Results.name, parser.Results.id);

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 22 Sep 2021
Modifié(e) : MathWorks Support Team le 22 Sep 2021
The above error message may be caused by certain paths being present in your PATH variable, and/or other environment variables set on your system. For example, if a native ROS 2 installation is present, there might be a library conflict between it and MATLAB's ROS 2 libraries.
PATH variable:
As a first step, inspect the value of your PATH environment variable by entering the following command at the MATLAB Prompt:
>> getenv('PATH')
The idea is to remove potentially problematic paths from PATH within MATLAB. In particular, remove entries such as:
C:\Program Files\rti_connext_dds-6.0.0\lib\x64Win64VS2015;
C:\WINDOWS\System32\OpenSSH\;
C:\OpenSSL-Win64\bin\;
C:\dev\ros2\Scripts;
C:\dev\ros2\bin;
C:\Program Files\Docker\Docker;
C:\Program Files\Docker\Docker\resources\bin;
C:\ProgramData\DockerDesktop\version-bin;
C:\OpenSSL-Win64\bin\;
To set a new PATH environment variable for your MATLAB session, use the following comands:
% minimum example of a new PATH variable
>> newpath = 'C:\Program Files\MATLAB\R2020b\bin\win64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\PROGRA~1\MATLAB\R2020b\bin;C:\Users\myUser\AppData\Local\Microsoft\WindowsApps;';
>> setenv('PATH', newPath)
>> ros2node('/test1')
​​​​
Other environment variables:
If shortening PATH within MATLAB does not help, look out for other environment variables that may interfere with ROS 2 libraries, such as RMW_IMPLEMENTATION.
Enter the following command at the MATLAB Prompt to get a list of all set enviroment variables:
>> system('set')
If you find RMW_IMPLEMENTATION in this list, you can unset it in MATLAB by using the following command:
>> setenv('RMW_IMPLEMENTATION','')

Plus de réponses (0)

Catégories

En savoir plus sur Network Connection and Exploration dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by