C++ ROS Node with ert.tlc succeeds but C++ executable with grt.tlc gives slros_initialize.h error

조회 수: 3 (최근 30일)
I am using ROS Melodic and Matlab 2020b on Ubuntu 18.04. I have a simulink model for publishing Joint Trajectories from Simulink to ROS enabled model in Gazebo (I am using ROS toolbox publisher and subscriber blocks) .
When I generate C++ ROS Node with ert.tlc. build is success and I can run the node successfuly from ROS terminal. But I need a C++ .exe file from this in realtime. So based on my requirement when I set system target file as grt.tlc.
Language: C++
Toolchain: Automatically locate an installed toolchain (it finds GNU gcc/g++ | gmake (64-bit Linux) on my system)
In Hardware Implementation I have set Device Type to x86-64 (Linix 64)
Solver has Type Fixed Step and Solver is auto
Fixed-step Size is 1.0
Build is not successful rest works fine and I get the following error
/home/has/simulink_models/makearmcommand_grt_rtw/makearmcommand.h:29:10: fatal error: slros_initialize.h: No such file or directory
#include "slros_initialize.h"
^~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake: *** [makearmcommand.o] Error 1

Build procedure for makearmcommand aborted due to an error.

I also looked for this header file in /usr/local/MATLAB/R2020b/simulink/include and I could not find it as well. But why it then gets generated during ert.tlc case (C++ ROS Node) is I dont understand.
Please advice. I am unable to understand how to fix it. Awaiting kind response.
NOTE: Generate Code only option is unchecked in my configuration options and after lookiong at various Matlab questions asked, I also tried by checking the Package Code and Artifiacts option and building but even using packngo option, it did not help me.
Best
Hasan
  댓글 수: 3
Ehtisham ul Hasan
Ehtisham ul Hasan 2021년 4월 30일
Hi,
Thank you for the response. If ROS Toolbox supports only Catkin toolchain then ert.tlc should work for me but I do not find the simulation running in real time when I launch the C++ ROS node for my model in Gazebo. I think this because the real time factor was between 0.7 to 0.8 and not close to 1.
Also I will be using the final controller on a real hardware and as per my understanding I will have to build it using grt.tlc and only then it will be processed by a realtime kernel to finally run the C++ executable on a ROS enabled real robot.
Please correct me if I am wrong and suggest suitable workflow if possible.
Thank you
Best
Hasan
Nicolas TESTARD
Nicolas TESTARD 2021년 6월 30일
Did you set the hardware board to ROS in the hardware implementation section of the configuration parameters?

댓글을 달려면 로그인하십시오.

답변 (1개)

Abhijeet Gadkari
Abhijeet Gadkari 2021년 5월 3일
Hello Hasan,
You must use "Robot Operating System (ROS)" as your hardware board setting (which automatically sets ert.tlc system target file) to generate a ROS node (especially when using ROS Simulink blocks) or ROS project from Simulink model. This hardware board setting auto selects all the required options including the required toolchain, Cakin, as mentioned by Jagadeesh in the comment. Changing the system target file to grt.tlc will reset all the settings done by hardware board and the generated code will not contain ROS related headers / sources and other ROS package dependencies as you observed.
You can deploy the standalone executable on your robot directly from Simulink model with this hardware board setting. If automatic deployment of standalone node generation does not meet your requirement, you can use the manual deployment steps. Manual deployement steps should allow you to make any necessary changes to the ROS package artifacts.
Please contact technical support if you need further assistance (especially real-time execution requirement).
-Abhijeet
  댓글 수: 1
Ehtisham ul Hasan
Ehtisham ul Hasan 2021년 5월 4일
Hi,
Thank you for the kind and detailed response. I will try this thing in parallel as due to time constraint I have started to write controller in C++ directly. This is indeed giving me tough time as I never wanted to adopt this pipeline but I remain curios and will explore further what you suggested soon.
Thank you for the support
Best
Hasan

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 ROS 2 Network Access in Simulink에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by