ROS2: How to generate code without makefile execution using Matlab coder

How can I generate code only when deploying ROS2 node from Matlab script? Dispite I configure coder not to build the node I get error "Current compiler MinGW64 Compiler (C++) is not supported for ROS build. To choose a compiler, run 'mex -setup cpp'..". Process is interrupted before the code is generated.
My build config is below. I tried to generate code from Simulink and it works when I check "Generate code only" option in Hardware settigs. I have now no other option than use remote device deployment (Linux pc with ROS2 installed).
Toolchain is correctly configured to "Colcon Tools".
cfg = coder.config('exe');
cfg.Hardware = coder.hardware('Robot Operating System 2 (ROS 2)');
cfg.Hardware.BuildAction = 'None'; % Do not build
cfg.GenCodeOnly = true; % Force to generate code only
cfg.Hardware.DeployTo = 'Localhost';

2 件のコメント

Jagadeesh Konakalla
Jagadeesh Konakalla 2022 年 4 月 27 日
Hi,
For now, Can you run mex -setup and choose the Microsoftvisual Studio 2017 or 2019 compiler before you run the codegen build command.
Thanks,
Jagadeesh
Marek Gal
Marek Gal 2022 年 4 月 27 日
Hello Jagadeesh,
thanks for your comment! Yes, that is a way, but I wanted to avoid installing 20GB of unnecessary junk into my PC :D It seems to me like a bug. Shall I report it somewhere else than on this forum?

サインインしてコメントする。

 採用された回答

Josh Chen
Josh Chen 2022 年 4 月 27 日

0 投票

Hello Marek,
Thanks for bringing this to our attention! This is a bug in both ROS and ROS 2 MATLAB code generation. We are currently working on the fix and it should be availble in a recent update.
Unfortunately, there is no workaround to generate code only in MATLAB for now. Please consider using remote deployment as an alternative before this issue get address.
Thanks,
Josh

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022a

質問済み:

2022 年 4 月 21 日

回答済み:

2022 年 4 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by