Rospy and Jython - TCPROS cannot start

asked 2015-06-23 23:29:13 -0500

aucklandbaxter gravatar image

Hello! I am currently using a Rethink Robotics Baxter robot, which uses Rospy and has interface scripts written in Python.

What we would like to do is to use Jython to execute those scripts, so that we can then write Java programs that import Jython and run the Python scripts. We have set up a development environment with Jython 2.7 and Rospy Indigo and have set all the necessary modules up correctly. However, when we try to init_node from the Jython interpreter, it seems that the TCPROS server cannot start.

>>> import rospy
>>> rospy.init_node('node_name', anonymous=True)
[ERROR] [WallTime: 1435119377.844000] unable to start TCPROS server: [Errno 107] Socket is not connected
Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/impl/", line 283, in start_server
  self.tcp_ros_server = TCPServer(self._tcp_server_callback, self.port)
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/impl/", line 132, in __init__
  self.server_sock = self._create_server_sock()
File "opt/ros/indigo/lib/python2.7/dist-packages/rospy/impl/", line 194, in _create_server_sock
  (self.addr, self.port) = server_sock.getsockname()[0:2]
File "/usr/local/lib/jython/", line 1368, in meth
  return getattr(self._sock,name)(*args)
File "/usr/local/lib/jython/Lib/", line 1242, in getsockname
  raise error(errno.ENOTCONN, "Socket is not connected")
error: [Errno 107] Socket is not connected

The same computer is able to talk to the robot via Python and Rospy, so it's not a networking problem. I think the problem is with Jython, as it has it's own implementation that uses Java sockets rather than Python sockets, but I can't see why that would make a difference. Does anyone have any ideas?

edit retag flag offensive close merge delete