Requirements Analysis

116 views
Skip to first unread message

Martin Riedel

unread,
Jun 19, 2012, 10:26:23 AM6/19/12
to ros-sig-matlab
This thread should be used to state additional requirements for a ROS-
MATLAB interface.


(Copy from the ROS SIG page)
This is a list of the following desirable features of an interface
between MATLAB and ROS:

1) The user would be able to use ROS functionalities from MATLAB and
Simulink when ROS is installed on the system. Different implementation
are possible to this end, and pros and cons will be discussed in the
group. Specifically, a "native" approach, in which the user is able to
use publishers, subscribers, timers, services and the parameter server
right within a mex function is harder to achieve but might potentially
be preferred to an approach such as IPC Bridge that relies on an
additional communication layer between ROS and MATLAB. Note that a big
challenge to such a "native" approach is the fact that MATLAB comes
with its own boost libraries that generally do not match the ones
provided by the system. This causes a segfault error as described here

2) The user would be able to generate code from Simulink blocks so
that they seamlessly work in ROS (similar to what’s possible for
OROCOS:http://www.orocos.org/orocos/orocos-simulink-toolbox). This
could in principle be done using the Simulink or MATLAB coder and
automatically wrapping the generated code so that it becomes a ROS
node with given ROS topics for input and output communication.

3) If would be nice to have a way to wrap ROS algorithms (the ones
available in C++) within mex files and s-functions so that they could
be used from MATLAB (from the command line) and Simulink (as Simulink
blocks) respectively, independently from ROS (e.g. having them
executed in other OSs). This can perhaps be seen as an extension or
supplement of point #1.

4) Also, as a longer-term goal, it would be nice to have a client
library so that basically MATLAB could be added to this list:
http://www.ros.org/wiki/APIs. This too can be seen as extension of
point #1 and #3.

Giampiero Campa

unread,
Oct 27, 2012, 10:13:03 PM10/27/12
to ros-sig...@googlegroups.com

So it looks (to me) like most of the solutions proposed so far address point #1 in the requirements list above, with different level of integration going from "low" (IPC bridge) to "medium" (native approaches that rely on calling ROS from a mex file) and "high" (using the rosjava implementation).

All this is of course great, but perhaps in some (many) cases running MATLAB, Simulink and ROS on the same system at the same time could be an overkill. Sometimes you have MATLAB on Windows and not on Linux, so running things together might be an hassle.

For those cases one could generate C code from a Simulink block (e.g. using the Simulink Coder with the Linux Target), and then compile the code on the ROS system (therefore linking it against the system libraries). The code will then run as a ROS node _independently_ from MATLAB. Note that in this case one is NOT generating a MEX file, but ultimately a Linux executable.

Something similar is done quite often for different hardware and software targets (e.g. code can be generated from Simulink that runs on the Arduino uno board, which has small ARM microcontroller).

The only problem i see with this approach is that one has to take care of adding the right message passing interface in the code, (perhaps under conditional compilation clauses so that it not do any "harm" if a mex file is generated from it, but then works as expected when actually running as an independent executable).

As usual, any comment or question is welcome ...

Max Seidenstücker

unread,
Sep 26, 2013, 7:52:16 AM9/26/13
to ros-sig...@googlegroups.com
I am currently starting work on a project that uses the ROS framework. My goal is to get the model driven design approach realized for some modules in the system. We'd like to create one module in MATLAB and generate code that can be used in the ROS environment. Ideally without changing or manually modifing the auto-generated code from MATLAB.

If I understand this correctly, you were mentioning this here also:

"For those cases one could generate C code from a Simulink block (e.g. using the Simulink Coder with the Linux Target), and then compile the code on the ROS system (therefore linking it against the system libraries). The code will then run as a ROS node _independently_ from MATLAB. Note that in this case one is NOT generating a MEX file, but ultimately a Linux executable."

So basically the input message to the MATLAB module should be auto-generated from a ROS msg file to create code that has the right message layout that then can be used to feed the MATLAB model. The model then should output a message that can be put into a ROS node for sending.

Am I correct that this is not covered by the IPC bridge, which is a connection between the two programs during runtime? What we like to have is just an automatic code generation to and from MATLAB. Any help on getting started with this is greatly appreciated.

Cheers

Max

Giampiero Campa

unread,
Oct 4, 2013, 5:51:12 PM10/4/13
to ros-sig...@googlegroups.com, Giampiero Campa
Hi Max, sorry for my late answer, i was on travel.

>> We'd like to create one module in MATLAB and generate code that can be used in the ROS environment.

Ok

>> If I understand this correctly, you were mentioning this here also ...

yes, that's what i was referring to.

>> So basically the input message to the MATLAB module should be auto-generated from a ROS msg file 
It sounds right, although technically the input to the matlab module can be anything that module is prepared to accept as an input, regardless on how you create the input.

>> The model then should output a message that can be put into a ROS node for sending.
Yes, again, you can do everything you want with the output but what you say seems the most obvious choice.

>> Am I correct that this is not covered by the IPC bridge, which is a connection between the two programs during runtime?
Yes, exactly. 

>> What we like to have is just an automatic code generation to and from MATLAB. 
I was referring exclusively to the "from MATLAB" part, but i suppose ROS can take care of the "to MATLAB" part.

>> Any help on getting started with this is greatly appreciated.
Let me know how this goes. One thing that's not clear is whether you are looking to generate the code from pure MATLAB or from Simulink. The framework for the latter case is a little more mature but both things can be done.

Giampy


--
You received this message because you are subscribed to the Google Groups "ros-sig-matlab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ros-sig-matla...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--

Giampiero Campa, PhD, Technical Evangelist,
MathWorks, 970 West 190St, Suite 530 (NW504), Torrance CA, 90502
Reply all
Reply to author
Forward
0 new messages