Matlab 2020b rosgenmsg() "error in using ros.intern​al.Package​Info/check​ForFiles"

My ROS environment is in Ubuntu18.04 in VMware, and my Matlab version is 2020b.
I have successfully connected ROS with Matlab, and installed CMake in windows.
I have packed the entire work space in ubuntu, and move it into windows, the location is
D:\MATLAB\toolbox\ros\mlroscpp\custom_messages
Here is my code:
rosgenmsg('D:\MATLAB\toolbox\ros\mlroscpp\custom_messages\catkin_ws\src')
Identifying message files in folder 'D:/MATLAB/toolbox/ros/mlroscpp/custom_messages/catkin_ws/src'..Done.
Validating message files in folder 'D:/MATLAB/toolbox/ros/mlroscpp/custom_messages/catkin_ws/src'..Done.
[0/5] Generating MATLAB interfaces for custom message packages... 0%错误使用 ros.internal.PackageInfo/checkForFiles (第 93 行)
File 'D:\MATLAB\toolbox\ros\mlroscpp\custom_messages\catkin_ws\src\matlab_msg_gen_ros1\win64\src\esr_radar\src\esr_radar_Object_common.cpp' does not exist.
出错 ros.internal.PackageInfo/set.LibSourceFiles (105 )
h.LibSourceFiles = checkForFiles(h, value);
出错 rosgenmsg (259 )
pkgInfos{iPkg}.LibSourceFiles = [pkgInfos{iPkg}.LibSourceFiles {fullfile(srcGenDir,genFiles{i})}];
I checked the path (D:\MATLAB\toolbox\ros\mlroscpp\custom_messages\catkin_ws\src\matlab_msg_gen_ros1\win64\src\esr_radar\src\), found that there is no cpp file named xxx_common.cpp.
I also tried to delete some package, but it seems that matlab always need to find this xxx_common.cpp
I don't know how to solve it, please offer me some suggestion.

1 Comment

btw, my purpose is playing rosbag and using subscriber in matlab to get GPS coordinates from ros, and then sent them into unreal engine for digital twins. The coordinates is sent by custom message in ros, so it is difficult for matlab to read, I encounter the problem above.

Sign in to comment.

 Accepted Answer

Well, I think I make this problem too difficult, and packing the entire work space leads to wired problems.
What you need to do is just take out the message file you need in ubuntu, put it into a spicific path, such as
c:\MATLAB\custom_msgs
and then rosgenmsg()

More Answers (0)

Categories

Products

Release

R2020b

Asked:

on 2 Jan 2022

Answered:

on 3 Jan 2022

Community Treasure Hunt

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

Start Hunting!