Ask Your Question

Launch ROSJava nodes using Java code

asked 2012-05-28 15:24:59 -0500

amittleider gravatar image

I have a GUI which is external to ROS (written in Java), and I would like it to be able to communicate with ROS nodes.

Ideally, the entry point of the program would be the GUI (so that the GUI will also launch the ros core and all necessary nodes), however, I'm not sure how to do this. Obviously, I can execute commands using exec, and therefore start ROS nodes by using: exec(roslaunch ...../mylaunch.launch), but if I do this, then there is no easy way for my GUI to communicate with the Java nodes.

For example, I would love to be able to write some code like this from the GUI:

MyRosNode myNode = new Node(); myNode.start();
and also write some code like this from the node:

I attempted to add rosjava.0.0.0.-SNAPSHOT.jar as an external library of my GUI, then setting up the pubsub tutorial, and launching the pubsub nodes from the GUI, but I am very stuck. I'm thinking the only way to do something like this is to change the entry point to the ROS node, then launch my GUI from the ROS node. Is this correct?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-05-29 10:33:26 -0500

jpiramirez gravatar image

I think I understand what you try to do, but I feel it contradicts the design principles behind ROS. Ideally, you would launch a bunch of nodes using a roslaunch script or something similar. Your GUI would be better focused if it interacted with said nodes through their topics. The current rosjava uses a script that executes the org.ros.RosRun class with your node class as an argument. If you really wanted to integrate a GUI + node launching, maybe you could add every JAR file generated by gradle as a dependency to your project... But since the API and almost everything in rosjava is still volatile it may be harmful to hardcode things that way.

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


Asked: 2012-05-28 15:24:59 -0500

Seen: 425 times

Last updated: May 29 '12