5

Is it possible to use the Matlab's system function to call ROS commands?

For example, using system('rostopic pub /cmd_vel geometry.msgs.Twist {....} or system('rospack find ipc_bridge).

I'm trying to send some commands to ROS without using something like IPC-Bridge.

PS: I know, however, that I need to use IPC-Bridge to subscribe to topics.

Ze Nog
  • 51
  • 1

1 Answers1

3

This is possible. But it is very sloppy, in my humble opinion. It is useful for one-off commands, but how will you read back output, verify your command was executed, etc.

If you are dead-set against the IPC bridge, you may want to look at using the MATLAB-java interface. ROS also allows you to program in Java using ros-fuerte-client-rosjava (ubuntu), or just rosjava.

Josh Vander Hook
  • 5,362
  • 20
  • 40
  • Ok. Then what am I doing wrong? How can I use the system function properly? – Ze Nog Nov 25 '12 at 10:30
  • Nothing wrong. Use it if it works for you. Just be sure to set up your bash environment correctly so your commands work. I can see this as helpful for running a matlab script, which then uses rosparam to set the output of the functions for nodes to read. However, I was referring to how difficult it might be to "close the loop" and use matlab to read from ROS ndoes. – Josh Vander Hook Nov 25 '12 at 17:36