- Generate a MEX file and run that. Do you get runtime errors? If so, those need to be addressed.
- Generate standalone code and enable the setting RuntimeChecks. Do you get errors running that?
- Are you calling the generated _initialize function prior to calling your generated code? If not, take a look at the code in codegen\lib\examples\main.c. The main function there is meant to be an example of how to invoke the generated code including calling the _initialize function.
Generate ROS cpp code from m file
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi everybody, I am trying to generate ROS cpp code for testing my controller on ROS-Gazebo simulation. I used "codegen" command to generate some C code files and built them with cpp files successfully. Unfortunately, when I ran the simulation, nothing worked. Could you please give me some advice for this situation? I attached m-files with this post, "controller.m" is the outer file which calls "Fuzzy.m" and "MRAC.m". Thank you.
1 commentaire
Ryan Livingston
le 5 Nov 2018
Can you elaborate on what you mean by "nothing worked"? Are there runtime errors? Is the behavior unexpected?
Some things to check:
Réponses (1)
Cam Salzberger
le 10 Déc 2018
Hello Tuan,
I'm afraid that C/C++ code generation for ROS-related functionality is not supported with MATLAB Coder. See this page for a list of Robotics System Toolbox functionality supported by MATLAB Coder. Also, please note that you can generate ROS-compatible C++ code from Simulink models using Simulink Coder.
Nothing I saw in your three files actually relates to ROS, as far as I could tell though. I am assuming that you have other M-files that you are using for the ROS code. Otherwise, I would suggeset checking the applicable toolbox's pages for codegen-capability, or the MATLAB Coder supported functions list to make sure everything is compatible.
-Cam
0 commentaires
Voir également
Catégories
En savoir plus sur Code Generation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!