Ask Your Question
0

Using 3rd party TCP socket within ROS service fails

asked 2015-06-25 04:38:57 -0600

francoisdtf gravatar image

updated 2015-06-26 04:23:07 -0600

Greetings,

Following my previous post (not necessary to read it, I decided to open a new topic since the following issue is quite different an could be encountered in a different situation), I decided, in short, to create a node advertising services aiming to communicate with the DAQ card Labjack UE9 through a TCP socket.

So, when the service is called, a command is sent to a previously opened (and stored as class member) TCP socket and an answer is expected from this same socket.

The problem is, it seems that this TCP communication interfers with the one ROS uses to call it services. Indeed, no answer is received (recv function returns -1), and the card doesn't execute the command. Plus, I get an error message from the client node, saying

a message of over a gigabyte was predicted in tcpros. that seems highly unlikely, so I'll assume protocol synchronization is lost.

I read a few issues regarding this message, but they seem to be all different and kind of esoteric, though it seems to be linked to TCPROS implementation.

In my case, the TCP connection used to call the service seems to interfer with the one I use to communicate the Labjack. Do you think it's accurate? Would there be a way to fix it?

I must add that, when I use the same program but use USB instead of TCP via ethernet to send commands to the card, it works perfectly, so the problem definitely comes from TCP communication.

EDIT :

When running roswtf while I send service requests, it tells me :

WARNING The following nodes are unexpectedly connected :

Te "somenumber" thingy changes everytime I run it, and strongly looks like a port number (44259 for example). Maybe it could be that the Labjack is sending back the TCP message to rosout instead of the node calling the command or something like this... I'm actually not that good in networking so I've got a hard time guessing where the issue comes from...

I configured my network with

ifconfig eth0 192.168.1.1 netmask 255.255.255.0

So it can communicate with the Labjack which IP address is 192.168.1.209

edit retag flag offensive close merge delete

Comments

2

It would help if you posted the code you are trying to get working. Opening a TCP socket in a ROS node is something that is fully supported and should just work. Many nodes do the same, so it looks like you're doing something that is not entirely correct.

gvdhoorn gravatar imagegvdhoorn ( 2015-06-26 05:37:14 -0600 )edit

Code would be helpful. Without enough information to reproduce the problem you're only going to get guesses toward the solution. In general I'd suggest creating small test programs to test each part separately. Once those are working try combining into a larger system.

tfoote gravatar imagetfoote ( 2015-06-27 03:31:15 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-06-29 05:00:33 -0600

francoisdtf gravatar image

Okay I'm really confused right now. I was opening the TCP connection in my class constructor, saving the socket ID in a class attribute. So I tried to open it directly in the service instead, and close it immediately. It worked, so I put it back as it was before, and surprisingly it worked this time

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

1 follower

Stats

Asked: 2015-06-25 04:38:57 -0600

Seen: 188 times

Last updated: Jun 26 '15