ROS compilation fails because 'slros_initialize.h' is missing.

10 vues (au cours des 30 derniers jours)
Markus
Markus le 17 Août 2015
The ROS example for Simulink
>> robotExROSGetStartedExample
runs fine, but compiling it for real-time execution fails, because the 'slros_initialize.h' is missing. The file should be automatically generated by the files listed in 'MATLAB/R2015a/toolbox/robotics/robotsimulink/robotslros/+robotics/+slros/+internal/+cgen'. The files should generate and save C++ code for creating a ROS node, and for creating C++ subscribers and publishers corresponding to Subscribe and Publish blocks in the model. However, they don't. The file 'slros_initialize.h' is not generated in the build folder or anywhere else on the system.
How can this issue be resolved?
Diagnostic output:
### Generasting code into build folder: /home/username/Desktop/Foldername/ROS_Example_prt
### Invoking Target Language Compiler on ROS_Example.rtw
### Using System Target File: /usr/local/MATLAB/R2015a/rtw/c/prt/prt.tlc
### Loading TLC function libraries
............
### Building ROS_Example: /usr/local/MATLAB/R2015a/bin/glnxa64/gmake -f ROS_Example.mk MAT_FILE=1 ISPROTECTINGMODEL=NOTPROTECTING OPTS="-DON_TARGET_WAIT_FOR_START=0"
.gcc -c -std=gnu99 -pedantic -fwrapv -fPIC -DON_TARGET_WAIT_FOR_START=0 -DEXT_MODE -DGLNXA64 -DUSE_RTMODEL -O2 -D_GNU_SOURCE -DMODEL=ROS_Example -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=0 -DUNIX -DMT=0 -DHAVESTDIO -I. -I.. -I/usr/local/MATLAB/R2015a/simulink/include -I/usr/local/MATLAB/R2015a/extern/include -I/usr/local/MATLAB/R2015a/rtw/c/src -I/usr/local/MATLAB/R2015a/rtw/c/src/ext_mode/common -I/home/username/Desktop/Foldername/ROS_Example_prt -I/home/username/Desktop/Foldername -I/usr/local/MATLAB/R2015a/toolbox/coder/rtiostream/src/utils "ROS_Example_data.c"
In file included from ROS_Example_data.c:21:0:
ROS_Example.h:35:30: fatal error: slros_initialize.h: No such file or directory
#include "slros_initialize.h"
^
compilation terminated.
gmake: *** [ROS_Example_data.o] Error 1
  3 commentaires
Tobias Blume
Tobias Blume le 22 Avr 2016
I solved this problem by setting: code--> c/c++-Code --> Code Generation Options --> Hardware Implementation --> Hardware board
set this parameter to ROS.
also see tutorial
Rahul Bhadani
Rahul Bhadani le 16 Mai 2016
Also, make sure roscore is running while doing code generation.

Connectez-vous pour commenter.

Réponses (1)

Josh Chen
Josh Chen le 17 Avr 2023
Hello Markus,
As Tobias suggested, please change the hardware board seeting to 'Robot Operating System (ROS)'. This is required to ensure the code generation process pick up all required predefined codes.
Thanks,
Josh

Catégories

En savoir plus sur Publishers and Subscribers dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by