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

ROS node communicating with a TCP device

asked 2012-06-04 03:42:22 -0600

nlauzier gravatar image

updated 2014-01-28 17:12:33 -0600

ngrennan gravatar image


I have a device which is communicating using the TCP/IP protocol and I already have a QT application to control it via a PC. I am now looking to create a ROS driver to control the device.

I was wondering if there is an easy way to create a TCP socket using ROS to send custom TCP frames to a device. From what I have read, the TCPROS package is used to communicate between ROS nodes, not between a node and a device.

One option I am looking for is to use my application code (c++) which is built around the QT4 libs (QTcpSocket, QByteArray, etc.). I would then need to integrate this into ROS to make the node publish the device status and subscribe to receive commands for the device.

Is using the QT libs the easiest way to do this or is there a better, more standard way to build ROS drivers for TCP devices?



edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2012-06-04 05:35:44 -0600

joq gravatar image

As @dornhege said, there is no standard way.

There are definite advantages to starting with a working non-ROS driver. Adding the necessary ROS initialization and message creation is generally straightforward.

However, if this driver is intended for widespread use, I would worry about the weight of the Qt dependencies. We generally like to minimize driver dependencies, so they can run on "headless" controllers with limited resources. That goal is not always achieved, but we do try.

I have written a couple of drivers for devices with UDP or TCP interfaces. For them, wrapping the raw C interfaces in an ad-Hoc C++ class worked fine. There are probably good light-weight C++ socket classes available, but I am not familiar with any.

edit flag offensive delete link more

answered 2012-06-04 04:09:14 -0600

dornhege gravatar image

AFAIK, there is no standard way. Using the Qt libraries seems a good choice, especially since you already have the majority done. Build the ROS node for the device should prove easy then.

edit flag offensive delete link more

Question Tools


Asked: 2012-06-04 03:42:22 -0600

Seen: 1,668 times

Last updated: Jun 04 '12