{"action":"closed","issue":{"url":"https://api.github.com/repos/rosjava/rosjava_core/issues/249","repository_url":"https://api.github.com/repos/rosjava/rosjava_core","labels_url":"https://api.github.com/repos/rosjava/rosjava_core/issues/249/labels{/name}","comments_url":"https://api.github.com/repos/rosjava/rosjava_core/issues/249/comments","events_url":"https://api.github.com/repos/rosjava/rosjava_core/issues/249/events","html_url":"https://github.com/rosjava/rosjava_core/issues/249","id":237370485,"number":249,"title":"Connect a ROSJava node with ROS running on Docker","user":{"login":"jabrena","id":147263,"avatar_url":"https://avatars3.githubusercontent.com/u/147263?v=3","gravatar_id":"","url":"https://api.github.com/users/jabrena","html_url":"https://github.com/jabrena","followers_url":"https://api.github.com/users/jabrena/followers","following_url":"https://api.github.com/users/jabrena/following{/other_user}","gists_url":"https://api.github.com/users/jabrena/gists{/gist_id}","starred_url":"https://api.github.com/users/jabrena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jabrena/subscriptions","organizations_url":"https://api.github.com/users/jabrena/orgs","repos_url":"https://api.github.com/users/jabrena/repos","events_url":"https://api.github.com/users/jabrena/events{/privacy}","received_events_url":"https://api.github.com/users/jabrena/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-06-20T23:10:47Z","updated_at":"2017-06-21T12:28:16Z","closed_at":"2017-06-21T12:28:16Z","body":"Hi,\r\n\r\nI am trying to develop some ROS nodes for EV3 Brick and I have some mini problems with the communication between ROSJava and a ROSCore running on a Docker image.\r\n\r\nIn the past, I participated in the development of the support for NXT:\r\nhttp://wiki.ros.org/nxt_lejos\r\n\r\nIn the development, I am using a ROS distro from a Docker Image to run `roscore`:\r\nhttp://wiki.ros.org/docker/Tutorials/Docker\r\n\r\n``` \r\n➜  docker run -it -p 11311:11311  ros\r\nexport ROS_MASTER_URI=http://${DOCKER_HOST}:11311/\r\nroot@8a35e37140d5:/# roscore\r\n... logging to /root/.ros/log/b2d34ffc-560c-11e7-b8c7-0242ac110002/roslaunch-8a35e37140d5-35.log\r\nChecking log directory for disk usage. This may take awhile.\r\nPress Ctrl-C to interrupt\r\nDone checking log file disk usage. Usage is <1GB.\r\n\r\nstarted roslaunch server http://8a35e37140d5:40671/\r\nros_comm version 1.12.7\r\n\r\n\r\nSUMMARY\r\n========\r\n\r\nPARAMETERS\r\n * /rosdistro: kinetic\r\n * /rosversion: 1.12.7\r\n\r\nNODES\r\n\r\nauto-starting new master\r\nprocess[master]: started with pid [46]\r\nROS_MASTER_URI=http://8a35e37140d5:11311/\r\n\r\nsetting /run_id to b2d34ffc-560c-11e7-b8c7-0242ac110002\r\nprocess[rosout-1]: started with pid [59]\r\nstarted core service [/rosout]\r\n```\r\n\r\nOnce, I have roscore running, in a gradle workspace, I am trying to run on localhost a simple rosjava example which run 2 nodes: Talker & Listener:\r\n\r\n``` java\r\n\r\nimport nodes.Listener;\r\nimport nodes.Talker;\r\nimport org.ros.RosCore;\r\nimport org.ros.node.DefaultNodeMainExecutor;\r\nimport org.ros.node.NodeConfiguration;\r\nimport org.ros.node.NodeMain;\r\nimport org.ros.node.NodeMainExecutor;\r\n\r\nimport java.net.InetAddress;\r\nimport java.net.UnknownHostException;\r\nimport java.util.concurrent.TimeUnit;\r\n\r\npublic class ROSJavaTest {\r\n\r\n    private static RosCore mRosCore;\r\n\r\n    public static void main(String [] args) throws UnknownHostException {\r\n\r\n        mRosCore = RosCore.newPublic(\"6a36967c0c57\", 11311);\r\n        mRosCore.start();\r\n        try {\r\n            mRosCore.awaitStart(5, TimeUnit.SECONDS);\r\n        } catch (InterruptedException e) {\r\n            e.printStackTrace();\r\n        }\r\n        System.out.println(\"Ros core started\");\r\n\r\n        startChatter();\r\n\r\n        //TODO Improve this way\r\n        while (true) {}\r\n    }\r\n\r\n    private static void startChatter() throws UnknownHostException {\r\n\r\n        NodeMainExecutor e = DefaultNodeMainExecutor.newDefault();\r\n\r\n        System.out.println(\"Starting listener node...\");\r\n        NodeConfiguration listenerConfig = NodeConfiguration.newPrivate();\r\n        //String host = InetAddress.getLocalHost().getHostAddress();\r\n        //NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(host);\r\n        listenerConfig.setMasterUri(mRosCore.getUri());\r\n        listenerConfig.setNodeName(\"Listener\");\r\n        NodeMain listener = new Listener();\r\n        e.execute(listener, listenerConfig);\r\n\r\n        System.out.println(\"Starting talker node...\");\r\n\t    NodeConfiguration talkerConfig = NodeConfiguration.newPrivate();\r\n\t    talkerConfig.setMasterUri(mRosCore.getUri());\r\n\t    talkerConfig.setNodeName(\"Talker\");\r\n\t    NodeMain talker = new Talker();\r\n\t    e.execute(talker, talkerConfig);\r\n\r\n    }\r\n\r\n}\r\n```\r\n\r\nIf the name of the host is: `http://8a35e37140d5:40671/` I am trying to connect to that image, but I receive some errors. in the connection:\r\n\r\n``` \r\nRos core started\r\nStarting listener node...\r\nStarting talker node...\r\njun 21, 2017 12:06:55 AM org.ros.internal.node.client.Registrar <init>\r\nINFORMACIÓN: MasterXmlRpcEndpoint URI: http://8a35e37140d5:40671/\r\njun 21, 2017 12:06:55 AM org.ros.internal.node.client.Registrar <init>\r\nINFORMACIÓN: MasterXmlRpcEndpoint URI: http://8a35e37140d5:40671/\r\njun 21, 2017 12:06:55 AM org.ros.internal.node.client.Registrar onPublisherAdded\r\nINFORMACIÓN: Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</Listener, http://127.0.0.1:57082/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>\r\njun 21, 2017 12:06:55 AM org.ros.internal.node.client.Registrar onPublisherAdded\r\nINFORMACIÓN: Registering publisher: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</Talker, http://127.0.0.1:57083/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>\r\njun 21, 2017 12:06:55 AM org.ros.internal.node.client.Registrar callMaster\r\nGRAVE: Exception caught while communicating with master.\r\njava.lang.RuntimeException: java.net.UnknownHostException: 8a35e37140d5\r\n\tat org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:157)\r\n\tat com.sun.proxy.$Proxy0.registerPublisher(Unknown Source)\r\n\tat org.ros.internal.node.client.MasterClient.registerPublisher(MasterClient.java:145)\r\n\tat org.ros.internal.node.client.Registrar$1$1.call(Registrar.java:138)\r\n\tat org.ros.internal.node.client.Registrar$1$1.call(Registrar.java:135)\r\n\tat org.ros.internal.node.client.Registrar.callMaster(Registrar.java:111)\r\n\tat org.ros.internal.node.client.Registrar.access$100(Registrar.java:51)\r\n\tat org.ros.internal.node.client.Registrar$1.call(Registrar.java:135)\r\n\tat org.ros.internal.node.client.Registrar$1.call(Registrar.java:132)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: java.net.UnknownHostException: 8a35e37140d5\r\n\tat java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)\r\n\tat java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)\r\n\tat java.net.Socket.connect(Socket.java:589)\r\n\tat java.net.Socket.connect(Socket.java:538)\r\n\tat java.net.Socket.<init>(Socket.java:434)\r\n\tat java.net.Socket.<init>(Socket.java:286)\r\n\tat org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)\r\n\tat org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:91)\r\n\tat org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFactory.java:158)\r\n\t... 1 more\r\n\r\njun 21, 2017 12:06:55 AM org.ros.node.DefaultNodeMainExecutor$RegistrationListener onError\r\nGRAVE: Node error.\r\njava.lang.RuntimeException: java.net.UnknownHostException: 8a35e37140d5\r\n\tat org.ros.internal.node.xmlrpc.XmlRpcClientFactory$1.invoke(XmlRpcClientFactory.java:157)\r\n\tat com.sun.proxy.$Proxy1.hasParam(Unknown Source)\r\n\tat org.ros.internal.node.client.ParameterClient.hasParam(ParameterClient.java:116)\r\n\tat org.ros.internal.node.parameter.DefaultParameterTree.has(DefaultParameterTree.java:66)\r\n\tat org.ros.internal.node.DefaultNode.start(DefaultNode.java:197)\r\n\tat org.ros.internal.node.DefaultNode.access$000(DefaultNode.java:85)\r\n\tat org.ros.internal.node.DefaultNode$1.run(DefaultNode.java:173)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: java.net.UnknownHostException: 8a35e37140d5\r\n\tat java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)\r\n\tat java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)\r\n\tat java.net.Socket.connect(Socket.java:589)\r\n\tat java.net.Socket.connect(Socket.java:538)\r\n\tat java.net.Socket.<init>(Socket.java:434)\r\n\tat java.net.Socket.<init>(Socket.java:286)\r\n\tat org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)\r\n\tat org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java:91)\r\n\tat org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFactory.java:158)\r\n\t... 1 more\r\n``` \r\n\r\n**Source:**\r\nhttps://github.com/ev3dev-lang-java/examples/tree/rosjava-helloworld/rosjava-helloworld\r\n\r\nHow to solve the problem?\r\nHow to get the ip of that image?\r\n\r\nMany thanks in advance.\r\n\r\nCheers.\r\n\r\nJuan Antonio"}}
{"actor":{"display_login":"adamantivm"}}