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

Sending data stream to c++ Struct

asked 2012-02-13 08:48:34 -0600

bzt gravatar image

updated 2014-01-28 17:11:21 -0600

ngrennan gravatar image


I'm looking to use the a Data Stream from RoS to fill out a C++ Struct for visual output on a Windows GUI.

Currently, the data would go from being published on Ubuntu to a listener on Windows, then the data needs to be put into the C++ struct. I'm not sure how to accomplish that last bit. How would you normally move a data stream to a usable output (outside of RoS)?

Thanks for any help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-02-13 09:04:21 -0600

DimitriProsser gravatar image

The easiest way to send data from a ROS program to a Windows program (assuming that you don't want to use ROS for Windows) would be through sockets. Your Windows program could provide the client socket, and your ROS application could provide the socket server. Whenever you want to send a message to the Windows program, you would serialize the message however you see fit (since if you're not using ROS, you can't use ROS's serialization). If the message type is constant, this should be trivial.

Sockets also allow two-way communication, so you could then send messages from ROS to Windows and vice versa with no problem. In my opinion, sockets are the easiest, most practical method by which to perform IPC (Inter-Process Communication) over networks.

edit flag offensive delete link more


Thanks! If I were to use RoS for Windows, so that RoS would already handle the networking/communication, how would I pull that data stream from Windows RoS to put it in a seperate C++ struct?

bzt gravatar image bzt  ( 2012-02-13 09:06:01 -0600 )edit

If you were using ROS for Windows, you'd simply have to create a subscriber (just like in Ubuntu) and the ROS backend would take care of the rest. It would act as a regular message from any other ROS node.

DimitriProsser gravatar image DimitriProsser  ( 2012-02-13 09:10:46 -0600 )edit

Question Tools


Asked: 2012-02-13 08:48:34 -0600

Seen: 988 times

Last updated: Feb 13 '12