0
$\begingroup$

Rosanswers logo

Hi,

I have another application that manages task execution, similar to Collagen. I would like to build a link between this application and ROSJava. I am very new to ROS and ROSJava. I have gone through most of the tutorials and have a primitive understanding. To start, I would like something like a proof of concept. The application sends a task to be executed, ROSJava sends a confirmation (just a string for now), repeat. It should be something similar to the pubsub talk/listener tutorial, except that there is a talk / listener on both sides. Any idea on how I could achieve this?

Thanks!


Originally posted by jforkey on ROS Answers with karma: 82 on 2013-02-15

Post score: 0


Original comments

Comment by PeterMilani on 2013-02-17:
How does your application that manages task execution present information. I'm no java programmer, but if you can establish a message pipeline between your management application and a java class, then your halfway there.

Comment by jforkey on 2013-02-18:
Thanks for your reply. The task manager uses javascript to call the functions the robot should execute. IE, task manager decides it's time to execute task, executes a javascript function - which are sent to ROS as a java method that ROS interprets, executes, returns state, and waits for next task.

Comment by PeterMilani on 2013-02-18:
In ROSJAVA each node (that implements pubs and subs etc) is written as a java class that implements nodeMain. These are executed by a nodemainexecutor in your main Java Activity. Now your taskmanager has to pass a javascript statement to the class.

Comment by jforkey on 2013-02-18:
That's what I have been trying to do, but I think I am making an error somewhere along the line. I call a java method from javascript with something like Packages.org.example.Send("SetObject"), where send is the java method passing the instruction to the node. Your comments much appreciated.

Comment by PeterMilani on 2013-02-18:
you might need to post your code. Though I may not be able to help so much with the Java Script.

Comment by jforkey on 2013-02-19:
I'm having difficulty even creating the talker/listener from a separate java class. How would I invoke the Talker and Listener node from a separate java class? The talker/listener nodes compile and run with ./build/.. .org.ros..Talker. How would I make them run from a separate java class?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

I recommend you look into TCP communication. For the lab down the hall, I had to write a system that allows them to communicate from generic python code to some ROS C++ code I've written. This way, they can move the robot by just sending a command to a specific port, like "Set Speed (0.5, 0)."

The way I accomplished this is by constructing two threads, one to listen for messages and one to control the robot.


Originally posted by allenh1 with karma: 3055 on 2013-02-18

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$
0
$\begingroup$

Rosanswers logo

The only time I've been able to pass information to a Java node from a java activity (and beyond) is during initialisation of the class that is the node.

Your java program could accept an argument that is your message that could then be passed to the node, sent as a serviceclient, or published once or so, and then shutdown the complete program. This may be slow, but might be acceptable.

I've posted a question about dynamically sending data to nodes from within their activities.

cheers Peter


Originally posted by PeterMilani with karma: 1493 on 2013-02-18

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.