window10下MATLAB编译ros2自定义消息

本文介绍如何使用MATLAB 2021a、Visual Studio 2017及Python 3.7.0对自定义ROS2消息进行编译,并解决编译过程中可能出现的错误。同时,还涉及了Simulink发送设置的问题排查。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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是否正确。

 

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值