Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Launch ROSJava nodes using Java code

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?