Performance ROS in Simulink

2 views (last 30 days)
Mikhail
Mikhail on 8 Oct 2020
Commented: Mikhail on 27 Oct 2020
Hello. I launched the "robotROSGetStartedExample.slx" model. I set the simulation time to 20 seconds. On my computer, this very simple model runs for about 6 seconds of real time. To increase the speed, I decided to write an analog of the Publisher block (in the form of an S-function). In its code, in the mdlStart function, I call ros::init. When running the model with the S-function, Matlab returns an error of the "segmentation violation detected" type. Does anyone have any ideas? I use Matlab R2018b, Ubuntu 18.04, ROS Melodic.
  2 Comments
Abhijeet Gadkari
Abhijeet Gadkari on 26 Oct 2020
Edited: Abhijeet Gadkari on 26 Oct 2020
Hello Mikhail,
There are multiple reasons this may not work.
  • Environment setup required to invoke ROS from S-funciton
  • Unmet dependencies of S-function on ROS Melodic installation
  • Data-conversion between S-function and ROS C++ messages
Try C++ code-generation instead if you want "real-time" execution of the algorithm.
- Abhijeet
Mikhail
Mikhail on 27 Oct 2020
Hello, Abhijeet. Thanks for your reply. In my post I actually asked two questions: 1) Why do ROS blocks in Simulink work so slowly? If I used UDP data transfer, the execution time of the model was reduced by 1000 times. What is the reason for this behavior? 2) Why I can't write an S-function containing calls to ROS functions? The ros::init function in S-function code is enough for Matlab crashing. It is possible that there is a problem with the boost library (link: https://github.com/lagadic/matlab_ros_bridge). What do you think about it?

Sign in to comment.

Answers (0)

Categories

Find more on Publishers and Subscribers in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!