Generate custom ROS messages in Matlab running on Windows using Cmake from Ubuntu install on WSL2

11 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Cam Salzberger
Cam Salzberger am 2 Mär. 2021
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 Kommentare
Afsoon Nejati Aghdam
Afsoon Nejati Aghdam am 12 Mai 2021
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
Cam Salzberger am 13 Mai 2021
Bearbeitet: Cam Salzberger am 13 Mai 2021
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Custom Message Support finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by