ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Make ROS talk between two programs

asked 2016-09-11 00:10:25 -0500

GoBaxter gravatar image

I am asking a general question to which general answers would suffice. As part of a project, I am working on a MATLAB program that does some data analysis on some pre-stored data and outputs numbers. These numbers have to be used by a C++ program to do further processing. The Matlab code works and so does the C++ code.

Now we want to use ROS to allow them to talk in real-time: Matlab sends data to C++ as it is produced on which C++ acts and outputs final result in a specified manner. Can someone please direct me to a coding source where ROS has been used to make a Matlab code talk to C++ code. I am using Ubuntu 16.04 and Matlab R16a.

If someone could chart out a communication architecture and give programming tips to implement it, that would be very helpful. But online references should work too.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-11 02:15:29 -0500

koeberlue gravatar image

updated 2016-09-11 02:27:01 -0500

I can only provide you with online references, but they should be sufficent for your problem.

I am assuming you already installed ROS on your pc. Then you can follow this tutorial to communicate between Matlab and the ROS master. http://mathworks.com/help/robotics/ex...

The next step would be communicate between your C++ program and the ros master. You can follow this tutorial: http://wiki.ros.org/ROS/Tutorials/Wri...

(If you are completly new to ros, you should probably begin right here to understand the core concepts: http://wiki.ros.org/ROS/Tutorials )

Further tips: Your Matlab progam will be a publisher. It will publish messages on a topic (you can choose the name of the topic yourself). The C++ program will be a subscriber. You subscribe to the previous defined topic and a callback will be called everytime the Matlab program publishes a message. Inside the callback you can use the message for whatever you need.

Check the default message types to see if any of them fits your data structure or define your own message type, as seen in the tutorials.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2016-09-11 00:10:25 -0500

Seen: 234 times

Last updated: Sep 11 '16