Unable to start ros2 node

21 views (last 30 days)
Bert Van Acker
Bert Van Acker on 4 May 2023
Answered: Prabeen Sahu on 9 May 2023
I'm unable to start a ros2 node on Matlab 2022a running on Windows 10.
Error indicates that the lib,wros2server cannot be launched. How can this be solved?
>> ros2node('/test1')
Error using ros2node/createNode
Error creating the ROS 2 node /test1.
Error in ros2node (line 129)
createNode(obj, parser.Results.name, parser.Results.id);
Caused by:
Error using ros.internal.Node/create
Server failed to start. Details: Unable to launch Simple server: Unable to launch C:\Program
Files\MATLAB\R2022a\toolbox\ros\bin\win64\libmwros2server.exe
because: Unable to launch Simple server: Unable to launch server: initialization failed
  2 Comments
Prabeen Sahu
Prabeen Sahu on 8 May 2023
Hello Bert,
The error message you mentioned occurs when MATLAB cannot start the "ibmwros2server.exe" executable, which is responsible for launching the ROS2 node. This issue is typically caused by conflicting environment variables.
Please close MATLAB and reopen from a fresh command prompt and then try creating ROS 2 node. By restarting MATLAB from a newly opened command prompt, you can ensure that any conflicting environment variables are cleared, which should help in successfully creating the ROS 2 node.
If you're still encountering the same problem, please run the following command in MATLAB and share the resulting file with us. This will assist in further investigating the issue.
>>ros.internal.generateSupportFile
-Prabeen
Bert Van Acker
Bert Van Acker on 8 May 2023
Hello,
I tried to restart MATLAB but this does not solve the issue.
In attachment the support log.
Thanks in advance

Sign in to comment.

Answers (1)

Prabeen Sahu
Prabeen Sahu on 9 May 2023
Hi Bert,
Based on the attached support file, it appears that the 'RMW_IMPLEMENTATION' environment variable is currently set to 'rmw_fastrtps_cp', which is incorrect. The correct value for this variable should be 'rmw_fastrtps_cpp', which uses the default DDS as FAST DDS.
To correct this issue, please use the following command to set the RMW_IMPLEMENTATION environment variable to the correct value:
setenv('RMW_IMPLEMENTATION','rmw_fastrtps_cpp')
Alternatively, you can simply unset the RMW_IMPLEMENTATION environment variable using the following command:
setenv('RMW_IMPLEMENTATION','')
This will remove the RMW_IMPLEMENTATION environment variable and allow the system to automatically use the default RMW implementation which is 'rmw_fastrtps_cpp'.
After making above change please start the ROS 2 node and let us know if you still face any issues.
-Prabeen

Categories

Find more on Custom Message Support in Help Center and File Exchange

Tags

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!