Why do I get an error about a missing ros_struct​msg_conver​sion.h header file when compiling generated C++ code for ROS interfaces?

1 回表示 (過去 30 日間)
I wrote MATLAB code that contains interface functions from ROS Toolbox that support code generation (such as "rossubscriber", "rospublisher", "rosrate"). Then, I generated  C++ code from this function using MATLAB Coder.
When I relocated the code to my ROS environment to compile it, I got an error about the shipped file "mlroscpp_sub.h" which includes a header file named "ros_structmsg_conversion.h" that is missing. Unfortunately, I cannot find this header file anywhere in the MATLAB installation.

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 7 月 28 日
To generate the ros_structmsg_conversion.h header file, make sure that you have selected "Robot Operating System (ROS)" as hardware in the MATLAB Coder build configuration.
The following documentation page shows the correct workflow for the programmatic approach:https://www.mathworks.com/help/releases/R2021a/ros/ug/matlab-programming-for-code-generation.html
When using MATLAB Coder App, set the Hardware board to "Robot Operating System (ROS)" as shown below:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeROS 2 Network Connection and Exploration についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by