running a rosjava node within jython

asked 2013-11-20 11:16:03 -0500

Albatross gravatar image

How would I set up a rosjava node to publish and subscribe to topics, and have it run in a jython script?

I am able to get the rosjava_tutorial_pubsub code to run, but that uses command line to start the node, but I'd like it to be run from within another program.

I would like to be able to write some java code that can publish and subscribe to topics, in a file called, and then from jython (or another java file) be able to import the MyNode class to be used.

i.e. in jython

import MyNode

node = MyNode() #instatiate the node
msg = node.get_message() #get the latest message that the node received
node.send_message("hello") #send a message using the node's publisher

Something like this is fairly straightforward in rospy, but unfortunately rospy is based on cpython, and I haven't been able to get that working in jython, so I'm looking into rosjava instead.

This is related to my other question, but specific to running in jython, and I am okay with a solution that requires packages/workspaces/gradle to set up.


edit retag flag offensive close merge delete