ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Running rosjava Node

asked 2011-09-19 04:49:41 -0500

vbare gravatar image

updated 2011-09-19 12:16:22 -0500

tfoote gravatar image

I am using the pure java based rosjava not the JNI. To install rosjava I did:

hg clone rosjava_core


rosmake rosjava

I tried running an example rosjava Node by typing:

rosrun rosjava_bootstrap rosjava ParameterServerTestNode

based on the info that

rosrun rosjava_bootstrap < pkg > < node_class > [args ... ]

I get:

Buildfile: /home/tori/ros_workspace/rosjava_core/rosjava/dependencies.xml


Total time: 1 second
Executing command: ['java', '-classpath', u'/home/tori/ros_workspace/rosjava_core/rosjava/target/org.ros.rosjava-0.0.0.jar:/home/tori/.ros/rosjava/lib/org.ros.rosjava.test_ros-0.0.0.jar:/home/tori/.ros/rosjava/lib/org.ros.rosjava.roscpp-0.0.0.jar:/home/tori/ros_workspace/rosjava_core/apache_xmlrpc/target/org.ros.rosjava.apache-xmlrpc-3.1.3.jar:/home/tori/ros_workspace/rosjava_core/rosjava_bootstrap/target/org.ros.rosjava.rosjava_bootstrap-0.0.0.jar:/home/tori/.ros/rosjava/lib/org.ros.rosjava.std_msgs-0.0.0.jar:/home/tori/.ros/rosjava/lib/org.ros.rosjava.rosgraph_msgs-0.0.0.jar:/home/tori/ros_workspace/rosjava_core/apache_commons_util/target/', 'org.ros.RosRun', 'ParameterServerTestNode']
Loading node class: ParameterServerTestNode
Unable to locate node: ParameterServerTestNode

I went through the tutorial here

and used the source from the rosjava_tutorial_pubsub (the rosjava publish subscribe tutorial)

and again was unsure as to how to run, for example, Listener.class.

Any help as to how to run a rosjava Node would be greatly appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2011-09-20 01:46:28 -0500

damonkohler gravatar image

The following should run Listener from the pubsub tutorial:

rosrun rosjava_bootstrap rosjava_tutorial_pubsub org.ros.tutorials.pubsub.Listener

You need to use the full class name.

edit flag offensive delete link more

answered 2011-09-25 13:09:25 -0500

jonjake gravatar image

I am having a similar problem to this but the next step. I had the pubsub Listener code working eariler today and now it does not.

When I execute rosrun rosjava_bootstrap rosjava_tutorial_pubsub org.ros.tutorials.pubsub.Listener the node appears to start fine.

When I try rostopic pub -1 /chatter std_msgs/String Hello a RosRuntimeException: is thrown.

Is there something obvious here I am doing wrong? Any ideas?

edit flag offensive delete link more


Are you using the rosjava version of roscore? Could you provide the complete stack trace please?
damonkohler gravatar image damonkohler  ( 2011-09-25 17:56:54 -0500 )edit

answered 2011-09-26 06:56:14 -0500

jonjake gravatar image

I am using the standard roscore. Here is the stack trace. It works intermittently and I cannot tell why.


rosrun rosjava_bootstrap rosjava_tutorial_pubsub org.ros.tutorials.pubsub.Listener

rostopic pub -1 /chatter std_msgs/String 'its working now'

... Loading node class: org.ros.tutorials.pubsub.Listener Sep 26, 2011 2:49:45 PM org.ros.internal.node.topic.UpdatePublisherRunnable run SEVERE: org.ros.exception.RosRuntimeException: connection timed out Sep 26, 2011 2:49:45 PM WARNING: An exception was thrown by a user handler while handling an exception event ([id: 0x0064c34e] EXCEPTION: connection timed out) org.ros.exception.RosRuntimeException: connection timed out at org.ros.internal.transport.ConnectionTrackingHandler.exceptionCaught( at at$Boss.processConnectTimeout( at$ at java.util.concurrent.ThreadPoolExecutor.runWorker( at java.util.concurrent.ThreadPoolExecutor$ at Caused by: connection timed out at$Boss.processConnectTimeout( ... 4 more

edit flag offensive delete link more


I have been playing with this a little bit more and determined the following: running both pieces of the pubsub example, Listener then Talker works correctly everytime. When I try running the Listener end and the using ros command line to publish to the node, like above, it rarely works and ends with the indicated exception. Hopefully this helps clarify the source of the problem a little more.
jonjake gravatar image jonjake  ( 2011-09-26 09:30:49 -0500 )edit

Question Tools


Asked: 2011-09-19 04:49:41 -0500

Seen: 1,029 times

Last updated: Sep 26 '11