How to add a matlab code to a ros package

asked 2018-05-26 13:29:46 -0500

elia gravatar image

updated 2018-05-27 04:45:59 -0500

gvdhoorn gravatar image


I have a ros package with several nodes which are all written in c++ and python, now i want to add another node which is in matlab,

also the output of this matlab node should be sent to a node which is written in python (i dont know it matter or not), so how can i do it, my assumption is that i have to change cmakelist file somehow to be able to make and build matlab code, is it true? if yes can anyone help me to do it?

I checked but all materials are about using matlab instead of ros, i couldn't find some easy issue like mine!


Edit: thank you for reply, first no i didn't use robotic toolbox,

about incorporation or communication, i'm not sure what you mean! so let me make an example,

consider i have a python node which name is PRINT, and its only job is to print a number,

on the other hand i have a matlab node that calculate a complex formula and obtain the final answer which name is RESULT,

now i want to send the obtained answer in RESULT to PRINT

It's all what i want to do...

edit retag flag offensive close merge delete


Also i have to add that i'm on ubuntu 14.04 and matlab 2017a also is installed on my ubuntu,

elia gravatar image elia  ( 2018-05-26 13:37:55 -0500 )edit

It will probably help potential future readers if you could clarify whether you want to:

  1. incorporate code generated by Matlab into a regular ROS node
  2. communicate between regular ROS nodes and a node generated by Matlab

Both are probably possible, but they are very different.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-27 04:00:45 -0500 )edit

Also: if you are using the Robotics Toolbox, it would appear this would be a question to ask Mathworks (if this isn't already explained in their documentation).

gvdhoorn gravatar image gvdhoorn  ( 2018-05-27 04:02:06 -0500 )edit