[ros-users] Hybridizing ROS with Blocking TCP/IP Stack

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
Subject: [ros-users] Hybridizing ROS with Blocking TCP/IP Stack
Perhaps a bit of a weird question for you all. I have a pre-existing large
windows code base that communicates via TCP/IP sockets. And looking to bring
it into ros by writing a a ROS node that accepts the TCP/IP socket message
and converts it to the appropriate ROS topic. The problem I'm currently
running into is that ros::spinOnce doesn't seem to like to behave and
publish messages as requested. Currently We have a simple client TCP/IP that
accepts the message, does some stuff to it (which works) than publishes to
the move_base_simple/goal topic, well in theory. The publishing isn't
happening. Since we are using accept() to get a message from the socket
(which is a a blocking call), the translator node, announces to the ros
network where its talking, spins once, than hits the blocking call to wait
for a message, than handles it, and publishes to the appropriate topic.
After the publishing command, it runs ros::spinOnce() again, then returns to
waiting for a socket message. Using printf messages I can see the
appropriate messages showing its getting stuck at the blocking call as
expected, but no messages are being sent on the ros topic. Any idea's of a
work around for this? Current thought is to spawn a thread for the TCP/IP
stack, and then using some combination of flag, and semaphore to control the
ROS publisher side of things. This code will need to be expanded to include
a couple ROS subscribers in the future as well.



Matt