Robotics StackExchange | Archived questions

[OSX] Unable to connect with ROS on Docker with a ROSJava node

Hi,

I am trying to use Docker on a OSX system to run latest ROS distro to communicate with some ROS Nodes implemented with Java

I followed the tutorial from ROS website: http://wiki.ros.org/docker/Tutorials/Docker

And I am exposing the ROSCore port 11311 in the computer with:

docker run -it -p 11311:11311  ros

And later, I execute this commands to run rosmaster and check that it is running inside of the container.

source ./ros_entrypoint.sh  
roscore & 
rostopic list 
/rosout 
/rosout_agg

root@b245fd69b0e3:/# roscore &
[1] 83
root@b245fd69b0e3:/# ... logging to /root/.ros/log/e1c313f4-56bd-11e7-8f14-0242ac110002/roslaunch-b245fd69b0e3-83.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://b245fd69b0e3:44547/
ros_comm version 1.12.7


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.7

NODES

auto-starting new master
process[master]: started with pid [94]
ROS_MASTER_URI=http://b245fd69b0e3:11311/

setting /run_id to e1c313f4-56bd-11e7-8f14-0242ac110002
process[rosout-1]: started with pid [107]
started core service [/rosout]

root@b245fd69b0e3:/# rosnode info rosout
--------------------------------------------------------------------------------
Node [/rosout]
Publications: 
 * /rosout_agg [rosgraph_msgs/Log]

Subscriptions: 
 * /rosout [unknown type]

Services: 
 * /rosout/set_logger_level
 * /rosout/get_loggers


contacting node http://b245fd69b0e3:35991/ ...
Pid: 107

root@b245fd69b0e3:/# 

Outside with network utility, I check that port are visible and from a remote host I verified with wget (a bit rudimentary):

robot@ev3dev:~$ wget
192.168.1.198:11311 converted 'http://192.168.1.198:11311' (ANSI_X3.4-1968) -> 'http://192.168.1.198:11311' (UTF-8)
--2017-06-21 19:54:23--  http://192.168.1.198:11311/ Connecting to 192.168.1.198:11311... connected. HTTP request sent, awaiting response... 501 Unsupported method ('GET') 2017-06-21 19:54:23 ERROR 501: Unsupported method ('GET').

But when I try to execute from the remote host, the ROSNode can connect:

robot@ev3dev:~$ java -jar rosjava-helloworld-0.1.0-SNAPSHOT-all.jar 192.168.1.198
192.168.1.198
Ros core started
Starting listener node...
Starting talker node...
Jun 21, 2017 7:55:35 PM org.ros.internal.node.client.Registrar <init>
INFO: MasterXmlRpcEndpoint URI: http://192.168.1.198:11311/
Jun 21, 2017 7:55:35 PM org.ros.internal.node.client.Registrar <init>
INFO: MasterXmlRpcEndpoint URI: http://192.168.1.198:11311/
Jun 21, 2017 7:55:53 PM org.ros.internal.node.client.Registrar onPublisherAdded
INFO: Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</Talker, http://127.0.0.1:33063/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
Jun 21, 2017 7:55:53 PM org.ros.internal.node.client.Registrar onPublisherAdded
INFO: Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</Listener, http://127.0.0.1:44603/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
Jun 21, 2017 7:56:04 PM org.ros.internal.node.client.Registrar callMaster
SEVERE: Exception caught while communicating with master.
org.ros.internal.node.xmlrpc.XmlRpcTimeoutException: org.apache.xmlrpc.client.TimingOutCallback$TimeoutException: No response after waiting for 10000 milliseconds.
    at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:140)
    at com.sun.proxy.$Proxy0.registerPublisher(Unknown Source)
    at org.ros.internal.node.client.MasterClient.registerPublisher(MasterClient.java:145)
    at org.ros.internal.node.client.Registrar$1$1.call(Registrar.java:138)
    at org.ros.internal.node.client.Registrar$1$1.call(Registrar.java:135)
    at org.ros.internal.node.client.Registrar.callMaster(Registrar.java:111)
    at org.ros.internal.node.client.Registrar.access$100(Registrar.java:51)
    at org.ros.internal.node.client.Registrar$1.call(Registrar.java:135)
    at org.ros.internal.node.client.Registrar$1.call(Registrar.java:132)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.xmlrpc.client.TimingOutCallback$TimeoutException: No response after waiting for 10000 milliseconds.
    at org.apache.xmlrpc.client.TimingOutCallback.waitForResponse(TimingOutCallback.java:77)
    at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:138)
    ... 14 more

Jun 21, 2017 7:56:05 PM org.ros.node.DefaultNodeMainExecutor$RegistrationListener onError
SEVERE: Node error.
org.ros.internal.node.xmlrpc.XmlRpcTimeoutException: org.apache.xmlrpc.client.TimingOutCallback$TimeoutException: No response after waiting for 10000 milliseconds.
    at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:140)
    at com.sun.proxy.$Proxy1.hasParam(Unknown Source)
    at org.ros.internal.node.client.ParameterClient.hasParam(ParameterClient.java:116)
    at org.ros.internal.node.parameter.DefaultParameterTree.has(DefaultParameterTree.java:66)
    at org.ros.internal.node.DefaultNode.start(DefaultNode.java:197)
    at org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:85)
    at org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:173)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.xmlrpc.client.TimingOutCallback$TimeoutException: No response after waiting for 10000 milliseconds.
    at org.apache.xmlrpc.client.TimingOutCallback.waitForResponse(TimingOutCallback.java:77)
    at org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:138)
    ... 9 more

Source code about example: https://github.com/ev3dev-lang-java/examples/blob/rosjava-helloworld/rosjava-helloworld/src/main/java/ROSJavaTest.java

Is it possible that the problem is the address of ROSMASTERURI:

ROS_MASTER_URI=http://b245fd69b0e3:11311/

How to change by the IP of the host machine: 198.168.1.198?

Any help?

Many thanks in advance

Juan Antonio


Edit:

I have tried to change the variable ROSMASTERURI with the name of my laptop and the IP but in both cases, roscore say that it is not a valid name and in bot cases, the variable uses another name and it is not possible to connect from outside.

WARNING: ROS_MASTER_URI [http://soulFactory.home:11311] host is not set to this machine
auto-starting new master
process[master]: started with pid [139]
ROS_MASTER_URI=http://d68cd6640059:11311/

I think that the connectivity problem is solved, the main issue is how to set a ROSMASTERURI valid to receive communications.

Laptop IP: 192.168.1.100

From outside, I can detect a port listening in the port 11311 but roscore is setted with other configuration and I think that this is the problem.

Juan Antonio

Asked by Juan Antonio BreƱa Moral on 2017-06-21 15:07:04 UTC

Comments

Answers