How can I create standalone application while using Robotics System Toolbox's rosgenmsg function?

3 views (last 30 days)
Hi all!
I've written a script that uses Robotics Systems Toolbox, I've created custom ROS messages evertything works fine. I want to create an executable from this script in order to call it from command line but Matlab Compiler does not support rosgenmsg function. So my question is, is there a possible work around this, or is there an alternative to rosgenmsg to create custom ros messages?
Thanks for your answers!
EDİT: I'm using ubuntu 16.04 LTS and matlab 2017b

Accepted Answer

Josh Chen
Josh Chen on 26 Oct 2020
Hello Dandanakan,
It is possible to use custom ROS messages in MATLAB Compiler with the following workaround. Since "rosgenmsg" is not supported for MATLAB Compiler, you can manually add the generated "jar" and "msggen" folder to the "Files required for your application to run" section when generating MATLAB Runtime application.
Taking this shipped document as an example. After running "rosgenmsg", you will have the following folder layout:
custom_msgs
-A
-...
matlab_gen
|- build
|- jar
|- msggen
When you run the "Application Compiler" app for the example_fun.m function, you need to add the "jar" and "msggen" folders under 'Files requried for your application to run". The "jar" folder contains the Java files for the custom message package and the "msggen" folder contains the necessary MATLAB files.
I have the following MATLAB code in the "example_fun.m" file as an example:
which('B.Standalone')
rosmessage('B/Standalone')
Hope this helps,
-Josh

More Answers (0)

Categories

Find more on ROS Custom Message Support in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by