Using 3rd party TCP socket within ROS service fails
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 :
- unknown ( http://localhost:somenumber/ ) -> /rosout (/rosout)
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
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.
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.