Why am I unable to create a ROS2 node on Windows 10?
17 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2020-11-5
编辑: MathWorks Support Team
2021-9-22
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);
采纳的回答
MathWorks Support Team
2021-9-22
编辑:MathWorks Support Team
2021-9-22
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','')
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Network Connection and Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!