Ask Your Question

ROS node communicating with a TCP device

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

nlauzier gravatar image

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

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 -0500

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 -0500

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


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

Seen: 1,432 times

Last updated: Jun 04 '12