1. 软件版本与配置
Matlab2021a 、Visual Studio 2017 、python3.7.0
利用matlab对自定义ros2消息进行编译,编译的文件夹类层次结构如红色线框。最后放置自定义消息的文件夹命名为msg。
2. 编译与报错处理
folderPath = fullfile(pwd,"R2_I");%命令行输入上述命令获取文件夹R2_I路径字符
ros2genmsg(folderPath)%进行编译
编译成功会显示:
如果报错
buildPackage(builder, [], ' --merge-install', colconMakeArgs); %other messag other messages might need to be present in the same directory Looking in the build log
卸载掉其它版本python,或其它和python关联的软件如conda等。
重新编译时报错:
The existence of the directory 'C:\Users\wei\source' will cause the build in directory
'D:\CAS\CAS\R2_I\matlab_msg_gen\win64' to fail. Remove or rename 'C:\Users\wei\source' and retry the command.
如提示所说,删掉\source 文件夹即可
3. 发送设置
simulink发送不出去,可检查Hostnam/IP Address是否正确。