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

1 Ansicht (letzte 30 Tage)
Markus
Markus am 17 Aug. 2015
Beantwortet: Josh Chen am 17 Apr. 2023
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 Kommentare
Tobias Blume
Tobias Blume am 22 Apr. 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 am 16 Mai 2016
Also, make sure roscore is running while doing code generation.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Josh Chen
Josh Chen am 17 Apr. 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

Kategorien

Mehr zu Publishers and Subscribers finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by