Ask Your Question
0

rosjava communication exception: org.ros.exception.RosRuntimeException: Connection exception

asked 2012-07-20 04:28:32 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi everyone, I'm new in rosjava. I'am now wrtting a subscriber in rosjava in rosjava node named mynode to "reveive" message type sensor_msgs/JointState from a publisher named /joint_states written in C++. The registering process was ok but there was an exception like the following:

Jul 20, 2012 4:12:50 PM org.ros.internal.node.client.Registrar callMaster
INFO: Response<Success, Registered [/mynode] as publisher of [/rosout], [http://auburn:46838/]>
Jul 20, 2012 4:12:50 PM org.ros.internal.node.topic.DefaultPublisher$1 onMasterRegistrationSuccess
INFO: Publisher registered: Publisher<PublisherDefinition<PublisherIdentifier<NodeIdentifier</mynode, http://127.0.0.1:33391/>, TopicIdentifier</rosout>>, Topic<TopicIdentifier</rosout>, TopicDescription<rosgraph_msgs/Log, acffd30cd6b6de30f120938c17c593fb>>>>
Jul 20, 2012 4:12:50 PM org.ros.internal.node.client.Registrar onSubscriberAdded
INFO: Registering subscriber: Subscriber<Topic<TopicIdentifier</joint_states>, TopicDescription<sensor_msgs/JointState, 3066dcd76a6cfaef579bd0f34173e9fd>>>
Jul 20, 2012 4:12:50 PM org.ros.internal.node.client.Registrar callMaster
INFO: Response<Success, Subscribed to [/joint_states], [http://auburn:56996/, http://auburn:41568/]>
Jul 20, 2012 4:12:50 PM org.ros.internal.node.topic.DefaultSubscriber$1 onMasterRegistrationSuccess
INFO: Subscriber registered: Subscriber<Topic<TopicIdentifier</joint_states>, TopicDescription<sensor_msgs/JointState, 3066dcd76a6cfaef579bd0f34173e9fd>>>
Jul 20, 2012 4:13:01 PM org.ros.internal.node.topic.UpdatePublisherRunnable run
SEVERE: org.ros.exception.RosRuntimeException: Connection exception: auburn/194.199.21.22:32880
Jul 20, 2012 4:13:01 PM org.ros.internal.transport.ConnectionTrackingHandler exceptionCaught
SEVERE: Channel exception: java.net.ConnectException: connection timed out
Jul 20, 2012 4:13:11 PM org.ros.internal.node.topic.UpdatePublisherRunnable run
SEVERE: org.ros.exception.RosRuntimeException: Connection exception: auburn/194.199.21.22:46961
Jul 20, 2012 4:13:11 PM org.ros.internal.transport.ConnectionTrackingHandler exceptionCaught
SEVERE: Channel exception: java.net.ConnectException: connection timed out
Jul 20, 2012 4:13:12 PM org.ros.internal.transport.ConnectionTrackingHandler exceptionCaught

**I wonder that why the subscribing process was ok while the message receiving was corrupted by an exception ? In the exception message below i saw an ip 194.199.21.22. This i not my computer ip address. Moreover the rosjava node ran on http://127.0.0.1:port but the roscore and other node in C++ ran on http://auburn:ports (auburn: name of my computer).

Everything was ok if i used a subscriber in C++.**

Thank,

edit retag flag offensive close merge delete

Comments

I'm getting the same problem and haven't fixed it yet but I traced it to org.ros.internal.node.topic.UpdatePublisherRunnable.run(UpdatePublisherRunnable.java:73). This line contains "selected.getAddress()" which is returning a bogus address.

liangfok gravatar image liangfok  ( 2012-07-21 22:21:00 -0500 )edit

The problem occurs when the publisher is written in C++ and the subscriber is written in Java. See: http://pharos.ece.utexas.edu/wiki/index.php/How_to_Publish_and_Subscribe_to_a_Custom_Topic_and_Message_using_ROSJava#Troubleshooting:_Connection_exception

liangfok gravatar image liangfok  ( 2012-07-22 17:49:49 -0500 )edit

Thank you so much liangfok :D. Your answer are a lot of help. I solved my problem. Yeahhhhhhhhhhh

NGUYEN gravatar image NGUYEN  ( 2012-07-22 22:28:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-07-22 19:53:02 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

The problem is your computer has a hostname that is being improperly resolved by DNS. Test this by opening a terminal and executing:

$ nslookup [your hostname]

In this case, your hostname appears to be "auburn".

The above command will probably return IP address "194.199.21.22". To fix the problem, either fix the DNS entry for "auburn" or change your hostname. One way to do this is to not assign a hostname to your computer by deleting /etc/hostname and then rebooting your machine.

The ROSJava method responsible for resolving a hostname into an IP address is org.ros.address.InetAddressFactory.newFromHostString(String host).

More details are posted here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-07-20 04:28:32 -0500

Seen: 931 times

Last updated: Jul 22 '12