Generate custom ROS messages in Matlab running on Windows using Cmake from Ubuntu install on WSL2
10 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to integrate Simulink running on Windows with a rosnode setup in Ubuntu 18.04 running in WSL2 on the same physical machine. The link seems to be working so that I can publish ROS messages from Simulink to the ROS node on linux, but I'm having problems generatying custom ROS messages in matlab with rosgenmsg() since my CMake compiler is located on the linux VM. Is there any way that I can point matlab to the CMake executable on my WSL2 setup?
I've been following the tutorial on custom ROS messages here (https://www.mathworks.com/help/ros/ug/create-custom-messages-from-ros-package.html)
here's where I'm at so far:
>> folderpath = fullfile('//wsl$/Ubuntu-18.04/home/eric/catkin_ws','src'); % set path to catkin workspace on WSL2 setup
>> rosgenmsg(folderpath) % Attempt to generate ROS messages
Identifying message files in folder '//wsl$/Ubuntu-18.04/home/eric/catkin_ws/src'..Done.
Validating message files in folder '//wsl$/Ubuntu-18.04/home/eric/catkin_ws/src'..Done.
[0/1] Generating MATLAB interfaces for custom message packages... 0%Error using ros.internal.utilities.getCMakeBinaryPath (line 19)
Could not find CMake in your system. Please install CMake version 3.15.5 or higher and rerun the command.
Error in ros.internal.CatkinBuilder.getCMakePath (line 82)
[aPath, aVersion] = ros.internal.utilities.getCMakeBinaryPath(ros.internal.CatkinBuilder.CMAKEMINVERSION);
Error in ros.internal.ROSProjectBuilder (line 391)
h.CMakePath = h.getCMakePath();
Error in ros.internal.CatkinBuilder (line 24)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in rosgenmsg (line 223)
builder = ros.internal.CatkinBuilder(genDir, pkgInfos{iPkg});
I have CMake 3.19 installed in Ubuntu on WSL2, but obviously Matlab isn't able to access this since it's running on Windows. Is there any way that I can point matlab to this CMake executable?
0 个评论
采纳的回答
Cam Salzberger
2021-3-2
Hello Eric,
You will need CMake installed on your Windows system, along with Visual Studio 2017 and Python 2.7. It's unlikely that the versions installed on your Ubuntu WSL2 would be configured correctly for building files on Windows, and a Windows-compatible compiler would be necessary in any case. CMake can easily be installed on Windows - just make sure it's on the system PATH.
-Cam
2 个评论
Afsoon Nejati Aghdam
2021-5-12
Dear Cam,
I receive the same error message.
folderpath = "C:\Users\Afsoon\Downloads\Applications\niryo_one_ros-master";
>> rosgenmsg(folderpath)
Identifying message files in folder 'C:/Users/Afsoon/Downloads/Applications/niryo_one_ros-master'..Done.
Validating message files in folder 'C:/Users/Afsoon/Downloads/Applications/niryo_one_ros-master'..Done.
[0/1] Generating MATLAB interfaces for custom message packages... 0%Error using ros.internal.utilities.getCMakeBinaryPath (line 19)
Could not find CMake in your system. Please install CMake version 3.15.5 or higher and rerun the command.
Error in ros.internal.CatkinBuilder.getCMakePath (line 82)
[aPath, aVersion] = ros.internal.utilities.getCMakeBinaryPath(ros.internal.CatkinBuilder.CMAKEMINVERSION);
Error in ros.internal.ROSProjectBuilder (line 391)
h.CMakePath = h.getCMakePath();
Error in ros.internal.CatkinBuilder (line 24)
h@ros.internal.ROSProjectBuilder(varargin{:});
Error in rosgenmsg (line 223)
builder = ros.internal.CatkinBuilder(genDir, pkgInfos{iPkg});
I have installed CMake, Visual Studio 2019, and Python 2.7. Also, CMake is available on the system PATH environment variable. I appreciate your advice on this issue!
Thanks,
Cam Salzberger
2021-5-13
编辑:Cam Salzberger
2021-5-13
I just saw your new question regarding this issue and responded there, before I saw this comment. Hopefully that answer can point you in the right direction.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Custom Message Support 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!