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

7 次查看(过去 30 天)
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 个评论
Tobias Blume
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.
also see tutorial

请先登录,再进行评论。

回答(1 个)

Josh Chen
Josh Chen 2023-4-17
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

类别

Help CenterFile Exchange 中查找有关 Publishers and Subscribers 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by