ROS compilation fails because 'slros_initialize.h' is missing.
이전 댓글 표시
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
James Wiken
2015년 8월 19일
Could you attach the "ROS_Example.h" file referenced at the end of the Diagnostic output? I built the example, and the '#include "slros_initialize.h"' line that is causing the error you are seeing is located on a different line than in the file I generated. I would like to see what is causing the difference.
Tobias Blume
2016년 4월 22일
I solved this problem by setting: code--> c/c++-Code --> Code Generation Options --> Hardware Implementation --> Hardware board
set this parameter to ROS.
Rahul Bhadani
2016년 5월 16일
Also, make sure roscore is running while doing code generation.
답변 (1개)
Josh Chen
2023년 4월 17일
0 개 추천
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
카테고리
도움말 센터 및 File Exchange에서 Code Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!